GridView控制項修改 刪除例項講解

2021-04-20 11:36:29 字數 1206 閱讀 2571

gridviewup.aspx.cs檔案**:

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 system.data.sqlclient;

public partial class gridview_gridviewup : system.web.ui.page

...}

protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e)

...private void gridviewbind()

...catch (exception ex)

...}

protected void gridview1_rowdatabound(object sender, gridviewroweventargs e)

...}

protected void gridview1_rowediting(object sender, gridviewediteventargs e)

...protected void gridview1_rowcancelingedit(object sender, gridviewcancelediteventargs e)

...protected void gridview1_rowupdating(object sender, gridviewupdateeventargs e)

...catch (exception ex)

...}

protected void gridview1_rowdeleting(object sender, gridviewdeleteeventargs e)

... 

catch (exception ex)

...}

}

SQL 修改刪除與GridView配合使用

using system using system.collections using system.configuration using system.data using system.linq using system.web using system.web.security using ...

增加 修改 刪除

alter alter table student add column 學歷 varchar 20 新增一欄位 學歷 alter alter table student add 星座 char 50 not null after 性別 在性別之後新增一欄位星座 update update stud...

DataGridView 修改 刪除

private int currow 0 滑鼠右鍵得到的當前行號 region 激發滑鼠事件,顯示右鍵選單,得到被選中的行的行號,注意第一列被隱藏的情況考慮 private int showrightmenu datagridview datagridview,contextmenustrip co...