Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
how can i find the id of a row i have a dropdown inside a grideview now i want to find that row id which dropdown's selected index changed
Posted

1 solution

C#
protected void dd1_selectedindexchanged(object sender, EventArgs e)
      {
          DropDownList DropDownList1 = sender as DropDownList;
          GridViewRow row = (GridViewRow)DropDownList1.NamingContainer;
          int rowIndex = row.RowIndex;
          Label Label3= (Label)GridView1.Rows[rowIndex].FindControl("Label3");

          Label lbl_price = (Label)GridView1.Rows[rowIndex].FindControl("lbl_price");
          Int32 price = Convert.ToInt32(lbl_price.Text);
              Int32 quantity   = Convert.ToInt32(DropDownList1.SelectedValue);
           String  total = (Int32.Parse(quantity.ToString())* Int32.Parse(price.ToString())).ToString();


           Label3.Text = total.ToString();


           sumtotal();

      }
 
Share this answer
 
Comments
Volynsky Alex 25-Sep-13 11:07am    
Fine!!!!!!!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900