hi
I use radiobutton in my page
<asp:RadioButtonList ID="RBLType" runat="server" RepeatDirection="Horizontal" TextAlign="right"
CssClass="Drbgalary">
<asp:ListItem Value="دارای گالری" Text="دارای گالری"><span style="color:#676767">دارای گالری</span></asp:ListItem>
<asp:ListItem Value="دارای محصول" Text="دارای محصول"><span style="color:Red">دارای محصول</span></asp:ListItem>
</asp:RadioButtonList>
AND
if (_dr["storetype"].ToString().Trim() == "دارای محصول")
{
RBLType.Items.FindByText("دارای محصول").Selected = true;
}
else
{
RBLType.Items.FindByText("دارای گالری").Selected = true;
}
but I run page below error happen
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 91: if (_dr["storetype"].ToString().Trim() == "دارای محصول")
Line 92: {
Line 93: RBLType.Items.FindByText("دارای محصول").Selected = true;
Line 94: }
Line 95: else {
best Regards
Neda