I have a Grid-view it contains dropdown list i want to way to when dropdown selected index change get gridview selected row cell values
in asp.net c#
I have a Grid-view it contains dropdown list i want to way to when dropdown selected index change get gridview selected row cell values
in asp.net c#
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Nov 8, 2022, 12:04 AM EST
On DropDownList SelectedIndexChanged event you can get selected row value.
protected void SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = (GridViewRow)(sender as DropDownList).NamingContainer; string firstColumnValue = row.Cells[0].Text; // Get values of first column }Jignesh KumarRank #91 · 22.9K reputationPosted Nov 7, 2022, 11:53 PM EST
Hello,
Based on sender you can identify the grid row and based on that row you can find cell values,
protected void ddlStatus_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlMappingStatus = (DropDownList)sender; if(ddlStatus.SelectedItem.Text.ToUpper() == "DONE") { } GridViewRow row = (GridViewRow)ddlMappingStatus.NamingContainer; // Gridview row where dropdown value changed String gridviewColumn1 = row.Cells[0].Text; // Get values of first column String gridviewColumn2 = row.Cells[1].Text; // Get values of second column }tharanga sahabandu91 reputationPosted Nov 8, 2022, 12:58 AM EST
thank you bro