通过注册页面按钮打开新页面,选择新页面中gridview中checkbox,选择好后,将选择的值传回注册页面的文本框。望各位大大好心帮助~ 通过注册页面按钮打开新页面,选择新页面中gridview中checkbox,选择好后,将选择的ID值传回注册页面的文本框。望各位大大好心帮助~弹出页面如这样 已经困扰我几天了。水平次,希望大家不要见笑啊GridViewCheckBoxjs c# .net 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 页面间怎么传值呢?querystring,如果你想用session也可以,或者cookie也成 你可以在一个页面中实现这个功能,给个div包含gridview (开始加载的时候 这个div是隐藏的) , 然后给“请选择”这个按钮做一个js =>>(控制新加的这个div的显示与隐藏 ) 最后你选择的值就在本页面可以操作了不需要页面间传递的 那就再加一个div2做 遮盖 透明度设置一下 这个div覆盖在div2上面 宽度位置设置一下 就OK了 做个模式窗体,然后做回传的json就OK了 那我后页面close后,前一页面在没有刷新的情况且不影响其他输入的情况下获得这个Session呢? 给你个例子吧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}&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就可以了 一个iframe显示的问题 请教页面嵌套的checkbox多选问题 gridview记录复选操作问题 30分求助.怎样获取Excel表单的名称. (急,在线等)关于框架的问题(C#+asp.net) ASP.net中关于datalist的问题 在ASP.NET中如何实现将选出的记录列表显示 sql语句问题 求大神帮忙 有出问题了,大吓帮忙啊 HttpPostedFile postedFile = Request.Files["Img"]获取不到前端的图片 MVC3 对一个或多个实体的验证失败 在代码中操作触发器
querystring,如果你想用session也可以,或者cookie也成
那我后页面close后,前一页面在没有刷新的情况且不影响其他输入的情况下获得这个Session呢?
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}&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就可以了