Make a server control accessible from within a Cla

Swobredxejepd

New Member
Hi! Can anyone tell me how to make a server control accessible from within a Class? In this case, I need to be able to add rows to my table (tableItem), but I get this error message: "BC30469: Reference to a non-shared member requires an object reference." The error occurs at this line: "tableItem.Rows.Add(tableRow)"<BR>I was told that the best way to make the server control accessible within the class is to pass the server control as a byref parameter to the printTable function, but I don't know how to do this. (Not even sure it works)<BR>I really appreciate any help I can get! Thanks. <BR><BR><script language="VB" runat="server"> <BR>Class editTable <BR>Public tableRow AS tableRow <BR>Public tableCell AS tableCell <BR><BR>Sub printTable() <BR>tableRow = New tableRow() <BR>tableCell = New tableCell() <BR>tableCell.Text = "test" <BR>tableRow.Cells.Add(tableCell) <BR>tableItem.Rows.Add(tableRow) <BR>End Sub <BR>End Class <BR><BR>Sub Page_Load(Sender AS Object, E AS EventArgs) <BR>End Sub <BR></script> <BR><BR><html> <BR><head> <BR><title></title> <BR></head> <BR><body> <BR><asp:table id="tableItem" runat="server"> <BR></asp:table> <BR></form> <BR></body> <BR></html>
 
Back
Top