图片地址:http://www.cvbbs.cn/attach.aspx?attachid=2567如上图所示,我怎么获取DataGridCustomer被选择行(即黄色背景行)每列的值,即客户代码的值,传递给下面代码ID。 代码如下: private void DataGridCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","c=this.style.backgroundColor;this.style.backgroundColor='#ffffcc'");
e.Item.Attributes.Add("onclick","window.open('ShowCustomer.aspx?id=??','main','height=500,width=470,top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");
}
} 向各位大虾求救,期待回复,先谢谢了!
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","c=this.style.backgroundColor;this.style.backgroundColor='#ffffcc'");
e.Item.Attributes.Add("onclick","window.open('ShowCustomer.aspx?id=??','main','height=500,width=470,top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");
}
} 向各位大虾求救,期待回复,先谢谢了!
解决方案 »
- 怎样注册含china或chinese的.com域名(这样的域名好申请吗)
- 如何把我以前申请的的花生壳域名定向到我新申请的真实域名上?
- 为什么我机器上的iis 里面的asp.net版本没有 1.1版本?
- petshop 在.net 2005下能否安装??
- 想寻求开发网页的资源,谢谢大家啦
- 用Defaultview来实现DataGrid的分页问题,请高手们帮忙!
- DataList控件EditItemTemplate中的控件如何访问?
- 求一个控件:可以支持输入的DropDownList控件。
- 如何实现定时发送电子邮件??
- 这里的人气值下降了,昨天提的问题今天还排在第一,而且每一个回复:(
- 请教gridview中使用ddl重新绑定数据的问题
- webconfig中的特殊字符问题?
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
string a=e.Item.Cells[0].Text;
e.Item.Attributes.Add("onmouseover","c=this.style.backgroundColor;this.style.backgroundColor='#ffffcc'");
e.Item.Attributes.Add("onclick","window.open('ShowCustomer.aspx?id=a','main','height=500,width=470,top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");
}
}
我是这样写,但还是不可以。id=a。不是当前行某一列的值
string a=e.Item.Cells[0].Text;
就是这个。
你试试看
不就是这个嘛要不你把第一列设成DataKeys
用DataGrid1.DataKeys[(int)e.Item.ItemIndex]