Highlight gridview row in update panel without posting back

后端 未结 3 1294
别那么骄傲
别那么骄傲 2021-01-21 05:39

I have a gridview in an update panel with the following code to select a row, this in turn updates another updatepanel with details from the form record.

prote         


        
3条回答
  •  一整个雨季
    2021-01-21 06:14

    How to highlight gridview when row is selected

    for this you have to write this code in your code behind file in OnRowCreated event or your can also write this code in OnRowDataBound event of grid...

        protected void ctlGridView_OnRowCreated(object sender, GridViewRowEventArgs e)
        {    
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", "onGridViewRowSelected('" + e.Row.RowIndex.ToString() + "')");
            }            
        }
    

    and add this one script

    
    

    and it will highlight the selected row..

提交回复
热议问题