Hi i am trying to check whether my RadioButton is checked or not in a method.If checked execute some code else execute another code.
But when i debug it I am getting this error
Object reference not set to an instance of an object
have gone through many links but not able to correct it.
Below is my .aspx.cs code
I am getting error at this line
RadioButton2 is defined in my .aspx page
Please Help.Thank You.
But when i debug it I am getting this error
Object reference not set to an instance of an object
have gone through many links but not able to correct it.
Below is my .aspx.cs code
Code:
public static string[] GetArea(string prefixText, int count)
{
RadioButton rb1 = RadioButton2;
if (rb1.Checked == true)
{
//execute some code
//return something
}
else
{
//else do this.
// return something
}
}
Code:
if (rb1.Checked == true)
Code:
<asp:RadioButton ID="RadioButton2" name="radios" CssClass="radio-button-style" runat="server" GroupName="list" Text="Chemist" ToolTip="SEARCH " />
Comment