using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
using ioiot.datacontrol;
public partial class admin_linksoperation : system.web.ui.page
}//繫結
private void gvbind()
//分頁,需要設定allowpaging="true"
protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e)
protected void gridview1_rowediting(object sender, gridviewediteventargs e)
//取id值需要設定datakeynames="linkid"
protected void gridview1_rowupdating(object sender, gridviewupdateeventargs e)
catch(exception ex)
gridview1.editindex = -1;
gvbind();
}protected void gridview1_rowcancelingedit(object sender, gridviewcancelediteventargs e)
protected void gridview1_rowdeleting(object sender, gridviewdeleteeventargs e)
catch (exception ex)
}//排序,需要設定allowsorting="true",同時在項裡需要設定 sortexpression="linkid"
protected void gridview1_sorting(object sender, gridviewsorteventargs e)
else
datatable dt = dcpub.selectalltable("links", "", "", "createdate");
dt.defaultview.sort = viewstate["sort"].tostring();
gridview1.datasource = dt.defaultview;
gridview1.databind();
}//全選
protected void alllinkselect_click(object sender, eventargs e)
alllinkselect.text = "取消";
}else
alllinkselect.text = "全選";}}
//刪除選擇項
protected void linkdel_click(object sender, eventargs e)
}if (delstr.tostring().trim().length == 0)
else
}catch (exception ex)
alllinkselect.text = "全選";
#endregion
}protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e)
else
= "沒有引數";
errmessage.text = "沒有引數";
}if (e.commandname.tostring() == "bottomstep")
}//rowcommand事件需要新增commandargument
protected void gridview1_rowcreated(object sender, gridviewroweventargs e)}}
}
GridView事件大全
using system using system.data using system.configuration using system.collections using system.web using system.web.security using system.web.ui usin...
GridView 屬性大全
這是個網格控制項 他的實現也是通過adapter來實現的,感覺跟listview在使用上並沒有多大的區別 常見屬性如下 1.android numcolumns auto fit gridview的列數設定為自動 2.android columnwidth 90dp 每列的寬度,也就是item的寬度...
GridView事件詳解
rowcommand 在 gridview 控制項中單擊某個按鈕時發生。此事件通常用於在該控制項中單擊某個按鈕時執行某項任務。pageindexchanging 在單擊頁導航按鈕時發生,但在 gridview 控制項執行分頁操作之前。此事件通常用於取消分頁操作。pageindexchanged 在單...