Highlight gridview row in update panel without posting back

后端 未结 3 1293
别那么骄傲
别那么骄傲 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:17

    I was struggling to add both on click events to the row databound:

    e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this.gvMainGrid, "Select$" + e.Row.RowIndex));   
    
    e.Row.Attributes.Add("onclick", "onGridViewRowSelected('" + e.Row.RowIndex.ToString() + "')");
    

    Appending the PostBack select after the row highlight method with ';' seems to have worked.

    e.Row.Attributes.Add("onclick", "onGridViewRowSelected('" + e.Row.RowIndex.ToString() + "');" + ClientScript.GetPostBackClientHyperlink(this.gvMainGrid, "Select$" + e.Row.RowIndex));
    

提交回复
热议问题