gridview控制項實現全選功能

2021-04-18 00:47:59 字數 1798 閱讀 7959

前台:

asp:gridview 

id="gridview1"

runat

="server"

allowpaging

="true"

autogeneratecolumns

="false"

="areaid"

datasourceid

="sqldatasource1"

>

<

columns

>

<

asp:boundfield 

datafield

="areaid"

headertext

="areaid"

readonly

="true"

sortexpression

="areaid"

/>

<

asp:boundfield 

datafield

="cityid"

headertext

="cityid"

sortexpression

="cityid"

/>

<

asp:templatefield

>

<

headertemplate

>

<

asp:checkbox 

id="chkall"

runat

="server"

autopostback

="true"

oncheckedchanged

="chkall_checkedchanged"

/>

headertemplate

>

<

itemtemplate

>

<

asp:checkbox 

id="chkitem"

runat

="server"

/>

itemtemplate

>

asp:templatefield

>

columns

>

asp:gridview

>

後台:

protected void chkall_checkedchanged(object sender, eventargs e)

}

gridview實現全選

拖個templ atefield 在編輯模板 headertemplate中 拖個checkbox 在前 寫js function change sender var table document.getelementbyid gridview1 for var i 1 itable.rows i ...

關於GridView 單頁全選,全選

介面設計 page language c autoeventwireup true codefile default15.aspx.cs inherits default15 後台 using system using system.collections.generic using system....

GridView控制項自動編號實現

gridview控制項自動編號實現,主要有二種方法 一 container.dataitemindex 1 二 protected void gvdatatypemanage rowdatabound object sender,gridviewroweventargs e 注意 當有分頁控制項一起...