asp.net - An object reference is required for the non-static field, method, or property '_Default.RadioButtonList2' -
i have gridview bind data database using stored procedure.
below part of code behind error above:
[webmethod] public static string getlist(int pageindex){ .... ..... cmd.parameters.addwithvalue("@customergroup", radiobuttonlist2.selectedvalue); //error here .... .... }
i have code gridview:
<asp:radiobuttonlist id="radiobuttonlist2" runat="server" autopostback="true" font-size="1em" enableviewstate="true"> <asp:listitem value="1">africa</asp:listitem> <asp:listitem value="2" >america</asp:listitem> <asp:listitem value="3">europe</asp:listitem> <asp:listitem value="4">asia/asp:listitem> <asp:listitem value="5">australia</asp:listitem> </asp:radiobuttonlist>
how value of radio button selected , pass stored procedures? when remove line code working.
problem have created webmethod, can not access server controls. remove it.
if required, pass radiobuttonlist2.selectedvalue in function client side.
[webmethod] public static string getlist(int pageindex,string radiovalue){ .... ..... cmd.parameters.addwithvalue("@customergroup", radiovalue); .... .... }
hope works.
Comments
Post a Comment