none
gridview text changed event

    Question

  • I have a gridview with 3 columns, out of which one column has textboxes. Is there a way to find which row fired the textchanged event and change the color of that row?

     

    Monday, October 15, 2007 6:54 PM

Answers

  • Never mind, i figured it out.

     

     

    TextBox tb1 = ((TextBox)(sender));

    GridViewRow gv1 = ((GridViewRow)(tb1.NamingContainer));

    int rownumber = gv1.rowindex;

     

    Thanks,

    Chirpy

    Thursday, October 18, 2007 8:00 PM

All replies

  •  

    you could take a look at the SelectedRow property (cant remember of by hand if that property exists as I don't have VS2005 open right now).

    Otherwise, what event have you implemented which will be fired when you are editing the cell?  I'm sure in the eventArgs (the second parameter) will have a property which exposes which cell/row you are in

    Monday, October 15, 2007 7:05 PM
  • The cell has a textbox and event that is fired when the text changes is text_changed(object sender, System.EventArgs e).

    This is specific to the textbox and doest have the row or cell property.

    Monday, October 15, 2007 7:53 PM
  • Seems you're talking about ASP.NET GridView control?

    Wednesday, October 17, 2007 6:39 AM
  • Never mind, i figured it out.

     

     

    TextBox tb1 = ((TextBox)(sender));

    GridViewRow gv1 = ((GridViewRow)(tb1.NamingContainer));

    int rownumber = gv1.rowindex;

     

    Thanks,

    Chirpy

    Thursday, October 18, 2007 8:00 PM