Friday 30 May 2014

Get Gridview RowIndex on Dropdownlist or Button event inside gridview in asp.net



//****************Dropdownlist SelectedIndexChanged Event

 protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (sender) as DropDownList;
        GridViewRow drr = (GridViewRow)ddl.NamingContainer;
        int rnd = drr.RowIndex;      //Row Index

//Here is your code
}


//****************Button _Click Event
 protected void Button _Click(object sender, EventArgs e)
    {
 Button Btn= (sender) as Button ;
        GridViewRow drr = (GridViewRow)Btn.NamingContainer;
       int rnd = drr.RowIndex;      //Row Index

//Here is your code
}

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...