ERROR : "method inaccessible due to its protection

shinobitest

New Member
&nbsp;<BR>I am trying to sort the datagrid rows, using the "OnSortCommand" property of datagrid.<BR><BR>1) My Datagrid web control declaration is :<BR>----------------------------------------<BR><asp:datagrid OnSortCommand="test" id="ModelDG" runat="server" AllowSorting="True" AutoGenerateColumns="False" ><BR><BR>(I am making sure that I am putting this inside <form> tags, for postback)<BR><BR>2)The Test method inside the class is :<BR>--------------------------------------<BR><BR>void test(Object obj, DataGridSortCommandEventArgs a)<BR>{<BR>this.tCodeName.Text = "Hello" ;<BR>}<BR><BR>Compilation Error:<BR>-----------------<BR>...test(object, System.Web.UI.WebControls.DataGridSortCommandEvent Args)' is inaccessible due to its protection level<BR><BR><BR>How to overcome this error ? Please help <BR>Are you using code-behind pages? Try doing this:<BR><BR>public void test(Object obj, ...)<BR>{<BR> ...<BR>}<BR><BR>(note I added "public" before the procedure name)Thanks a lot ! It works now !<BR><BR><BR>
 
Back
Top