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
I have gone through many links but not able to correct it.
Below is my .aspx.cs code
public static string[] GetArea(string prefixText, int count)
{
RadioButton rb1 = RadioButton2;
if (rb1.Checked == true)
{
//execute some code
//return some value;
}
else
{
//execute some other code
//return some value;
}
}
RadioButton2 is defined in my .aspx page
I am getting error at this line
if (rb1.Checked == true)Please help.Thankyou
Rojalin SahooPosted Jan 12, 2016, 6:42 AM
narasimman gPosted Jan 12, 2016, 4:18 AM
KAJAL TANEJAPosted Jan 12, 2016, 2:59 AM
narasimman gPosted Jan 12, 2016, 12:12 AM
KAJAL TANEJAPosted Jan 11, 2016, 4:48 AM
Ravi PatelPosted Jan 11, 2016, 4:38 AM
KAJAL TANEJAPosted Jan 11, 2016, 4:33 AM
Manas MohapatraPosted Jan 11, 2016, 4:14 AM
KAJAL TANEJAPosted Jan 11, 2016, 4:09 AM
Ravi PatelPosted Jan 11, 2016, 4:06 AM
KAJAL TANEJAPosted Jan 11, 2016, 4:05 AM
Manas MohapatraPosted Jan 11, 2016, 4:01 AM