熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

觸發gridview的行選擇事件

2022-06-13   來源: .NET編程 

  重寫render利用ClientScript在客戶端注冊select回發到服務器觸發服務器端的行選擇事件

   protected override void Render(HtmlTextWriter writer)

         {

             foreach (GridViewRow row in gvHeaderRows)

             {

                 if (rowRowType == DataControlRowTypeDataRow)

                 {

                     rowAttributes[onclick] = ClientScriptGetPostBackEventReference(gvHeader Select$ + rowRowIndexToString() true);

  

  

                     rowAttributes[style] = cursor:pointer;

                     rowAttributes[title] = 單擊選擇行;

  

                 }

             }

             baseRender(writer);

         }


From:http://tw.wingwit.com/Article/program/net/201311/12292.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.