我是这样作的。
我在主表的页面中写了一个javascript函数,用于定位到子表页面。 window.location=..
在主表的ItemDataBound事件中绑定到了ondblclick事件,传递给javascript函数相应的
单据编号,但是不知为什么,不能成功。
是不是我的思路错了
请明示,感激
我在主表的页面中写了一个javascript函数,用于定位到子表页面。 window.location=..
在主表的ItemDataBound事件中绑定到了ondblclick事件,传递给javascript函数相应的
单据编号,但是不知为什么,不能成功。
是不是我的思路错了
请明示,感激
public void MyDataGrid_OnItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
String ContractName = DataBinder.Eval(e.Item.DataItem, "ContractName").ToString();
String ContractID = DataBinder.Eval(e.Item.DataItem, "ContractID").ToString();
e.Item.Style["cursor"] = "hand";
e.Item.ToolTip = ContractName;
e.Item.ForeColor=Color.Blue;
e.Item.Attributes.Add("ondbclick","window.open('Details.aspx?ContractID="+ContractID+"','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,revisable=no,left=100,top=0,width=600,height=450'); return false;window.opener=null;window.close();");
}
}
但是,不知道为什么,没有成功,双击没有反应。上面的笔误“ondblclick"已经更改正确了。
还有 return false;window.opener=null;window.close();这一句不论有还是没有都不执行。
查看源,看到html中已经有了ondblclick声明。
能再看一下吗?
我的这个页面在frameset中的一个frame中。
谢谢!
http://218.84.107.5/contractmanagement/
我刚才又试过了,因为我在ItemDataBound事件中先执行下面的代码绑定了单击事件执行选定行。我把这些注释以后,可以了。
谢谢你。
如果你感兴趣,可以帮忙看一下下面的绑定单击事件,不知道是什么问题。
if(e.Item.ItemType==ListItemType.Header||e.Item.ItemType==ListItemType.Pager||e.Item.ItemType==ListItemType.Footer)
{
return;
}
LinkButton selectButton=(LinkButton)e.Item.Cells[0].Controls[0];
e.Item.Attributes["onclick"]=Page.GetPostBackClientHyperlink(selectButton,"");
我还要问一下,如果我的Detail.aspx和Main.aspx不在同一层文件夹中,那如何访问呢。
我正在学习Asp.Net的同时学习Javascript
谢谢
其实我使用和学习ASP.Net刚刚2个月左右,自学。
谢谢你的帮助。
我的OICQ:7620746;
信箱:[email protected]
我以前用Java,对J2EE也有一些了解。不过不是很深刻。
希望能多交流。