Skip to main content

Posts

Showing posts with the label row index in gridview in c#- Gridview Row index at Runtime

row index in gridview in c#- Gridview Row index at Runtime

Hello everyone, I'm going to share the code-sample of row index in gridview in c# .net  using on click of link-button and image button. Table of Contents 1.  On click link button find  gridview row index in C#. 2.  On click Image button  find  gridview row index in C#. Note: Image is a Temple field item, we create a click and then generate the events of on row and get the index. Using the line of code [ int index = ((( LinkButton )sender).Parent.Parent as GridViewRow ).RowIndex; ] and then get the Cell values with using index. i.e. [ string strFilePath = GridViewId.Rows[index].Cells[1].Text; ] For more details you can seen the below example. 1. Row index in gridview (On click link button) protected void lkbVideo_Click( object sender, EventArgs e) {     int index = ((( LinkButton )sender).Parent.Parent as GridViewRow ).RowIndex;     string strFilePath = GridViewId.Rows[index].Cells[1].Te...