sysdesigner Posted June 24, 2005 Posted June 24, 2005 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 Quote
Moderators Robby Posted June 25, 2005 Moderators Posted June 25, 2005 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). Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.