Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am dynamically building EditItemTemplate columns for a datagrid. Whenever

the "edit" or "update" commands are issued the event code fires but there

isn't any textbox controls in the Item collection. The following code yields a

"null" reference on postback, when there should be a textbox called txtOne in

the collection.

 

textBoxOne = (TextBox)e.Item.FindControl("txtOne");

 

Any ideas?

 

TIA ,

Shawn

 

PS. The following article shows the method that I am using to create the

template columns.

 

http://www.dotnetbips.com/displayarticle.aspx?id=84

  • Moderators
Posted

Your method for finding the control is fine but the problem is in the way that you're creating the controls;

 

You are probably adding an ItemTemplate but not an EditItemTemplate, so for each ItemTemplate you add you need to also add an EditItemTemplate, (In this case as a TextBox control).

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...