解决方案 »
- webbrowser如何处理网页提示和安全提示?
- asp的Session,aspx可以調用嗎?
- c#获取url部分的主机名
- 用EXecl打开一个文本,在另存为文本;
- 怎样设置Botton键字体的颜色
- c# 能否调用c++写的模板函数?
- C#如何进行进程注入
- 高手帮忙啊~~~~Socket和TcpListener在接收数据时,为什么总接收不完??
- Winform 程序中,添加引用一个组件,默认总是放在应用程序根目录下,我想放在一个MyDLL 目录下,怎么做??
- 请问一下这个有没有简单一点的写法?谢谢
- 通过Remoting接收的DataTable是否不能使用OracleCommandBuilder来更新?
- 初看C#问个简单的问题
<asp:DataGrid id="ListsGrid" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyField="ListID" OnEditCommand="ListsGrid_Edit" OnCancelCommand="ListsGrid_CancelEdit" OnUpdateCommand="ListsGrid_Update" OnDeleteCommand="ListsGrid_Delete" OnSortCommand="ListsGrid_Sort" Width="100%">
<Columns>
..
</Columns>在DataGrid中设置(DataKeyField="ListID") 是很重要的,需要有一个可以关系这个表格每条记录的主键,为什么不设DataKey呢?设置的时候是要绑定的一列字段名,不是具体值,系统会自动根据每条记录自动绑定的...DataGrid设计后,调协显示删除按钮的Cell
<asp:ButtonColumn Text="<img border=0 Alt='Delete this list' src=./Images/Delete.gif>" CommandName="delete" />
后台处理:
protected void ListsGrid_Delete(object sender, DataGridCommandEventArgs e)
//(int)ListsGrid.DataKeys[e.Item.ItemIndex]返回当前记录的DataKey(也就是ListID)值..
此事件响应删除操作...
string s = lbl.Text;