Gridview RowEditing event problem

Discussion in 'ASP .Net' started by =?Utf-8?B?V2lsbCBXaW5u?=, Apr 25, 2006.

  1. I have a gridview template field that I would like to get the value of during
    the RowEditing event, but can't figure out how.
    Here's an example of how I get the value of a cell for the row being edited:
    Dim WasherNum As String = gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).Text

    It works if the Cell is databount, but it doesn't work for a template field.
    How do I do it?
     
    =?Utf-8?B?V2lsbCBXaW5u?=, Apr 25, 2006
    #1
    1. Advertising

  2. TemplateFields contain controls that have value, they do not in themselves
    have values, in the way that BoundFields do. You need to reference the
    control. E.g. if the control was a textbox you could use the following in
    C#:

    TextBox MyTextBox =
    (TextBox)gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).FindControl("TextBoxID");

    MyTextBox.Text would then contain the value you want.

    "Will Winn" wrote:

    > I have a gridview template field that I would like to get the value of during
    > the RowEditing event, but can't figure out how.
    > Here's an example of how I get the value of a cell for the row being edited:
    > Dim WasherNum As String = gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).Text
    >
    > It works if the Cell is databount, but it doesn't work for a template field.
    > How do I do it?
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 25, 2006
    #2
    1. Advertising

  3. That did the trick.
    Thanks

    "clickon" wrote:

    > TemplateFields contain controls that have value, they do not in themselves
    > have values, in the way that BoundFields do. You need to reference the
    > control. E.g. if the control was a textbox you could use the following in
    > C#:
    >
    > TextBox MyTextBox =
    > (TextBox)gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).FindControl("TextBoxID");
    >
    > MyTextBox.Text would then contain the value you want.
    >
    > "Will Winn" wrote:
    >
    > > I have a gridview template field that I would like to get the value of during
    > > the RowEditing event, but can't figure out how.
    > > Here's an example of how I get the value of a cell for the row being edited:
    > > Dim WasherNum As String = gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).Text
    > >
    > > It works if the Cell is databount, but it doesn't work for a template field.
    > > How do I do it?
     
    =?Utf-8?B?V2lsbCBXaW5u?=, Apr 25, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Radu
    Replies:
    0
    Views:
    311
  2. egsdar
    Replies:
    0
    Views:
    3,270
    egsdar
    Nov 4, 2008
  3. DavidC

    GridView RowEditing issue

    DavidC, Mar 31, 2010, in forum: ASP .Net
    Replies:
    0
    Views:
    505
    DavidC
    Mar 31, 2010
  4. Shafia

    RowEditing event in GridView

    Shafia, Apr 19, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    206
    Shafia
    Apr 19, 2005
  5. dev648237923

    GridView RowEditing Requery question

    dev648237923, Feb 28, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    1,038
    Steven Cheng[MSFT]
    Mar 5, 2007
Loading...

Share This Page