can't retrieve data from rowupdating event gridview control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGF1bA==?=

    can't retrieve data from rowupdating event gridview control

    In the code below the first line works to read data from the gridview control
    but the second line the ltest label is null. The very first column of the
    grid is a bound data item that I converted to a template column. This column
    has a label called lblDiscID which gets populated on the gridview control
    correctly. Thanks.

    protected void gridview_RowUpd ating(object sender, GridViewUpdateE ventArgs
    e)
    {

    string DiscDescrip =
    Convert.ToStrin g((gridview.Row s[e.RowIndex].Cells[5].FindControl("t xbxDiscgv") as TextBox).Text);

    Label ltest = (gridview.Rows[e.RowIndex].Cells[0].FindControl("l blDiscID")
    as Label);

    ltest is always null!
    --
    Paul G
    Software engineer.
  • Munna

    #2
    Re: can't retrieve data from rowupdating event gridview control

    Hi,

    If you want to get the new values why don't you use
    e.NewValues dictionary

    well does find control on ther cell work?

    Best of luck

    Munna




    Comment

    • =?Utf-8?B?UGF1bA==?=

      #3
      Re: can't retrieve data from rowupdating event gridview control

      Hi thanks for the response. I was able to get it to work but the users want
      to be able to make several changes in different rows and then just hit a
      button to save it.
      I could get this to work if I could access the gridview data (including new
      changes) in the save button click event or the rowdatabound event. I was
      able to get the data off of the grid in the rowdatabound event but it did not
      seem to include any of the new data changes on the grid.
      --
      Paul G
      Software engineer.


      "Munna" wrote:
      Hi,
      >
      If you want to get the new values why don't you use
      e.NewValues dictionary
      >
      well does find control on ther cell work?
      >
      Best of luck
      >
      Munna
      >



      >

      Comment

      Working...