注册 登录
编程论坛 ASP.NET技术论坛

关于前后台传值取值的问题。。。

maple990 发布于 2010-09-11 10:35, 949 次点击
子窗体后台code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            e.Row.Attributes.Add("onDblClick", "javascript:opener.location.href='TallyMain.aspx?id=" + e.Row.Cells[1].Text.ToString() + "';window.close();");
         }

---
父窗体TallyMain.aspx后台代码
通过   
      string sid= Request.QueryString["id"];接受
父窗体TallyMain.aspx前台代码
js-code
function ShowTextBox(va) {   
            var value = va.innerText;
            va.innerHTML = "";
            var txt = document.createElement("input");
            va.appendChild(txt);
            txt.focus();
            txt.value = value;
            va.onclick= function() {
            }

            txt.setAttribute("onblur",
            function() {
                va.onclick = function() {
                    ShowTextBox(va);
                }
                va.innerHTML = "";
                va.innerText = txt.value;
            });
            }

html-code:
<table>
<tr>
<td onclick="ShowTextBox(this)">
ccc
    </td>
    <td onclick="ShowTextBox(this)">
ccc
                </td>
</tr>

问题是:我要从前台获取字窗体传过来的sid并且放在 td里创建的input里面  怎么弄??
俺是菜鸟  求代码。。



2 回复
#2
yms1232010-09-11 16:32
弹出窗体可以完全用javascript的opener
弹出窗体里直接javascript
opener.父窗体input的id或name.value="要传的值";
#3
Ben_faster2010-09-14 17:35
对,支持!
1