ASP .NET Web Controls

C

codeWarrior

I'm having trouble working with web controls from the C# code behind file. Some controls are accessible to me programatically, and some are not

For example, I trying to hide, or display an <asp:Table> on post back on the page, here is my code

HTML

<asp:Table id="commentTable" runat="Server"><asp:TableRow><asp:TableCell>Some Text</asp:TableCell></asp:TableRow></asp:Table

C# Code Behin

protected System.Web.UI.WebControls.Table commentTable

private void Page_Load(object sender, System.EventArgs e

commentTable.Visible = isPostBack


I get this error anytime I run the app

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object

Source Error:

Line 37: commentTable.Visible = isPostBack

If you have experienced a similiar problem, please help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top