Community discussion forum

datagrid edit command textbox reference

  • 6 months ago

    I'm trying to replace some text in a datagrid's textbox on edit. I've done this a thousand times, but I'm not seeing the problem. Stops on "tada" line with Object reference not set to an instance of an object. Any help appreciated.

    Protected Sub dgAnswers_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgAnswers.ItemCommand

    If e.CommandName = "Edit" Then dgAnswers.EditItemIndex = e.Item.ItemIndex CType(dgAnswers.Items(e.Item.ItemIndex).FindControl("txtAnsEdit"), TextBox).Text = "tada"

    Post was edited on 11/05/2009 14:05:05 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!