locked
How can i get the data of a column from a row when button on the same row is clicked? RRS feed

  • Question

  • User660049362 posted

    Here is my problem, below is a datagrid.

    po no.      department    date    status    action

    xxxxx       xxxxxxxx      xxx    xxxxx    approve/reject(button)

    when i click on the approve/reject button, i want to retrieve the po no. and store it into the session to use in another page. is that possible?

    any help will be appreciated.Smile

    Sunday, August 7, 2011 2:58 AM

Answers

  • User206766090 posted

    yes it is possible you should enable select in your grid view then make that culomns change to template and enable click event then in code behind write this to click event:

    session("something")=gridview1.selectedrow.cells(1).text.tostring

    then you can use youe session where ever you linke

    is that clear?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 7, 2011 11:45 AM

All replies

  • User-1299151298 posted

    protected void myGV_RowCommand(Object sender, GridViewCommandEventArgs e)

    02     {
    03         if (e.CommandName == "approve/reject")
    04         {
    05

         (Label) lblpo= (Label)e.Row[e.Row.Index].FindControl("NameOfPOLabel"); // if its po no. label

    Session["po"]=lblpo.Text;

    06
    08  
    09         }
    10  
    Sunday, August 7, 2011 3:21 AM
  • User206766090 posted

    yes it is possible you should enable select in your grid view then make that culomns change to template and enable click event then in code behind write this to click event:

    session("something")=gridview1.selectedrow.cells(1).text.tostring

    then you can use youe session where ever you linke

    is that clear?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 7, 2011 11:45 AM
  • User660049362 posted

    That really helps. Thanks a lot!

    Sunday, August 7, 2011 9:12 PM
  • User206766090 posted

    please mark as answer if it helps dont forget

    Monday, August 8, 2011 12:54 AM