window.showModalDialog 传值问题 高分求解

来源:百度知道 编辑:UC知道 时间:2024/05/21 09:15:06
在datagrid 里面有一列linkbutton 按钮 ,比如一共有10条记录,我想点一下linkbutton 就把它对应的那条记录的ID传到 window.showModalDialog
打开的模式对话框中,代码写到这里不会了(以下为datagrid中代码)
<ItemTemplate>
<asp:LinkButton Text="编辑平面图" runat=server ID=lnk1 OnClientClick="Javascript:var b=window.showModalDialog('map.aspx',(这里不知道写什么了),'dialogWidth:800px;dialogHeight:600px');></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>

或者是我思路本身就错误,但是必须要用那个模式对话框,然后必须把点击的那一项的对应ID传到map.aspx页面,请求帮助
对了,那个datagrid中的id列代码如下
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Bu_ID") %>'></asp:Label>
</ItemTemplate>

楼下的回答牛头不对马嘴啊

应该使用url传值才能在服务器及浏览器都能得到参数.

showModalDialog传值的参数只能是在浏览器中父子窗口传递.

你上面的代码可以改为:

<ItemTemplate>
<asp:LinkButton Text="编辑平面图" runat=server ID=lnk1 OnClientClick="Javascript:var b=window.showModalDialog('map.aspx?id=xxx','','dialogWidth:800px;dialogHeight:600px');></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>

其中id=xxx可以在写记录集的时候把xxx写上

然后在map.aspx上,服务器及浏览器都能得到id的值

服务器用request对象获得

浏览器由js从URL中获得

要是回答的内容有问题,或认为不妥,请发送百度消息给我,消息内容加上本页网址哦。。

·

修改a.html的openstr()方法,改为以下

function openstr()
{
ReturnValue=window.showModalDialog("b.html",window,"dialogWidth=510px;dialogHeight=150px;status=no");
if(ReturnValue && ReturnValue!="")
{
oOption = document.createElement('OPTION');
oOption.text=ReturnValue;
oOption.value=Re