0

How can I read a specific row and column in rowbound? If I had 2 values in my gridview, I want to read the per row and column in rowbound

code here

 protected void gvModal_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
            string idd = gvModal.DataKeys[e.Row.RowIndex].Value.ToString();
            string qa = "select Date_Issued, Quantity, Unit FROM Issuance_Consumables";
            GridView gvDet = (GridView)e.Row.FindControl("gvIssuance");

            gvDet.DataSource = GetData2(qa);
            gvDet.DataBind();
        }
    }

DateIUssued, Quantity and Unit will vary from the "Model","Company", etc from the string "idd"

L C
  • 438
  • 2
  • 10
  • 28
Jedi Ablaza
  • 171
  • 15
  • Check [get the value of a cell](http://stackoverflow.com/questions/10295401/how-to-get-value-of-a-cell-in-row-data-bound-event-and-how-to-check-if-a-cell-i). I think this might help. – Mushfiq Jul 11 '16 at 05:34
  • RowDataBound is fired for each row and that row controls are accessible in RowDataBound. To get the previous row GridViewRow prevrow = GridView1.Rows[e.Row.RowIndex - 1]; – Sami Jul 11 '16 at 05:53
  • Are you using nested GridView? – Rojalin Sahoo Jul 11 '16 at 12:28

1 Answers1

0

To achieve this, You need to get your respective cell value.

string value = e.Row.Cells[2].Text;

You can get the values like this and you can proceed.

Sivakishore Teru
  • 216
  • 1
  • 2
  • 9