通过注册页面按钮打开新页面,选择新页面中gridview中checkbox,选择好后,将选择的ID值传回注册页面的文本框。望各位大大好心帮助~
弹出页面如这样 
已经困扰我几天了。水平次,希望大家不要见笑啊GridViewCheckBoxjs c# .net

解决方案 »

  1.   

    页面间怎么传值呢?
    querystring,如果你想用session也可以,或者cookie也成
      

  2.   

    你可以在一个页面中实现这个功能,给个div包含gridview (开始加载的时候 这个div是隐藏的) , 然后给“请选择”这个按钮做一个js =>>(控制新加的这个div的显示与隐藏 ) 最后你选择的值就在本页面可以操作了不需要页面间传递的
      

  3.   

    那就再加一个div2做 遮盖 透明度设置一下  这个div覆盖在div2上面  宽度位置设置一下 就OK了 
      

  4.   

    做个模式窗体,然后做回传的json就OK了
      

  5.   


    那我后页面close后,前一页面在没有刷新的情况且不影响其他输入的情况下获得这个Session呢?
      

  6.   

    给你个例子吧
    html代码:<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            body
            {
                font-size: 12px;
                color: #444;
                font-family: tahoma,simsun;
                background: #f5f5f5;
                height: 100%;
                margin-left: 0;
            }
            #block
            {
                width: 100%;
                height: 100%;
                background: #000;
                position: absolute;
                top: 0;
                left: 0;
                z-index: 890;
                filter: alpha(opacity=50);
                opacity: 0.5;
                display: none;
            }
            
            #showbox
            {
                position: absolute;
                border: 5px solid #ddd;
                background: #fff;
                width: 400px;
                height: auto;
                top: 30%;
                left: 50%;
                margin-left: -200px;
                margin-top: -140px;
                z-index: 999;
                display: none;
            }
            .a0
            {
                height: 20px;
            }
            .a0 em
            {
                float: right;
                font-size: 13px;
                color: Red;
                cursor: pointer;
                text-decoration: underline;
            }
            ul, ol, dl
            {
                list-style: none;
            }
        </style>
        <script language="javascript" type="text/javascript">        function showgv() {
                document.getElementById("block").style.display = "block";
                document.getElementById("showbox").style.display = "block";        }        function hidegv() {
                document.getElementById("block").style.display = "none";
                document.getElementById("showbox").style.display = "none";
            }    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <%-- 遮罩层 --%>
            <div id="block">
            </div>
            <div id="showbox">
                <ul>
                    <li class="a0"><em class="gb" onclick="hidegv()">关闭</em></li>
                    <li>
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"
                            DataKeyNames="id">
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="id">
                                    <ItemTemplate>
                                        <span>
                                            <%#Eval("id") %></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="name">
                                    <ItemTemplate>
                                        <span>
                                            <%#Eval("name") %></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="time">
                                    <ItemTemplate>
                                        <span>
                                            <%#Eval("time") %></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="是否超时">
                                    <ItemTemplate>
                                        <span>
                                            <%#Convert.ToDateTime( Eval("time"))>DateTime.Now?"没有":"超时" %></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:HyperLinkField DataNavigateUrlFields="id,id" DataNavigateUrlFormatString='a.aspx?id={0}&amp;cmp={1}'
                                    DataTextField="id" HeaderText="ceshi" />
                            </Columns>
                        </asp:GridView>
                    </li>
                    <li>
                        <asp:Button ID="Button1" runat="server" Text="确定" OnClick="Button1_Click" /></li></ul>
            </div>
            <%--请选择文本 --%>
            <input id="Text1" type="text" runat="server" />
            <input id="Button5" type="button"
                value="请选择" onclick="showgv()" />
        </div>
        </form>
    </body>
    </html>
    cs代码:
     /// <summary>
            /// 点击显示文本中传来的值
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void Button1_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < this.GridView1.Rows.Count; i++)
                {
                    CheckBox cb = (this.GridView1.Rows[i].FindControl("CheckBox1")) as CheckBox;//获取复选框
                    string id = this.GridView1.DataKeys[i][0].ToString();
                    if (cb.Checked)
                    {                    this.Text1.Value = this.Text1.Value + id;
                    }
                }
            }其中你根据我的去设置 绑定数据自己绑定gridview就可以了