DataGrid 第二例是checkbox,第一列是id值,如何得到checkbox选中的id值?
解决方案 »
- vs2008 自带ajax extend能实现这个功能吗?
- 页面显示GIF图片的问题
- [求助]第一次翻页会多出一空行,但第二次翻页就正常
- 请问怎么样可以让 web 中的 datagrid象window中一样,自动的有一行是默认选择行呢??
- try...catch捕获不到异常,程序直接显示“无法显示网页”
- 行固定,列不固定可以用DataGrid,或别的实现吗?(也就是行列怎么转置)
- 域名频道的ASP.NET空间如何?
- 80 跪求 分求 淘宝 (最新)淘客API项目实例
- 谁能给出一个简单的C# 计数器. 有分
- 为什么我得asp.net文件不执行?
- 一个关于新闻详细内容显示的问题!
- GridView对数据库同时新增多行数据,再读出这些数据后并同时更新这些数据到数据库
问题二:“删除”可以作为超级连接列,通过传递的ID参数,来执行SQL语句,进行删除。
private void show_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==System.Web.UI.WebControls.ListItemType.Item||e.Item.ItemType==System.Web.UI.WebControls.ListItemType.AlternatingItem||e.Item.ItemType==System.Web.UI.WebControls.ListItemType.EditItem||e.Item.ItemType==System.Web.UI.WebControls.ListItemType.SelectedItem)
{
e.Item.Attributes["onmouseover"]="currentcolor=this.style.backgroundColor;this.style.backgroundColor='Gainsboro'";
e.Item.Attributes["onmouseout"]="this.style.backgroundColor=currentcolor";
} }
{
if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowType != DataControlRowType.Header && e.Row.RowType != DataControlRowType.Footer)
{ e.Row.Attributes.Add("onclick", "window.open('Busdetail.aspx?id2=" + ID2.ToString() + "&id1=" + ID1.ToString() + "')");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=\"" + e.Row.Style["BACKGROUND-COLOR"] + "\"");
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor=\"" + "#EFFFFF" + "\"");
}
第一句是单击行跳转一个新页面