类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
想完成以下功能:
页面 Button TextBox1 TextBox2
当按Button 出现一个新的弹出页面(不是替换原有的页面) 然后 在这个新弹出的页面有sTextBox1
sTextBox2 给这两文本框赋值 然后 单击确定 或者提交按钮 改页面关闭 原来那个页面的TextBox1的值等于sTextBox1的值 TextBox2的值也等于sTextBox2的值 如果直接关闭弹出页面 则不赋值。
写了这么多不知道讲清楚我的需求了没有
还有 怎么在客户端调用 Session 和Cookie呢?????
网友回答:
http://dotnet.aspx.cc/ShowDetail.aspx?id=49ML4AO8-5PB3-4KNY-NJZD-LJOIOXV4M1X4
session附值后直接用就行!
Page.Session["yy"]=你所要的传的值;
另一个页面里
this.TextBox.text=Page.Session["yy"].Tostring();
就可以了!
我有例子,如何给你?
去看msdn
搜索模式窗口
function closeWin()
{
window.opener.document.getElementById(txt1).value=document.getElementById(stxt1).value;
window.opener.document.getElementById(txt2).value=document.getElementById(stxt2).value;
window.close();
}
btn.Attributes["onclick"] = "javascript:closeWin(); return false;";
学习!!
可以用模式窗口。
window.showModalDialog 打开一个新窗口
window.returnValue 返回值。
如何点击按钮弹出新窗口,输入数据后返回并刷新页面:
http://dotnet.aspx.cc/ShowDetail.aspx?id=49ML4AO8-5PB3-4KNY-NJZD-LJOIOXV4M1X4
顶一下,不用谢了!!
父面页:
在HTML中的HEAD中加入以下代码,
<SCRIPT language="javascript">
function select_apply()
{
var a=document.Form1.textbox的ID.value;
document.Form1.textbox的ID.value=window.showModalDialog ("select_apply_no.aspx",null,"dialogWidth:500px;dialogheight:560px");
if(document.Form1.textbox的ID.value=="undefined")
document.Form1.textbox的ID.value=a;
}
</SCRIPT>
<form>中加入HTML按钮并设置其运行在服务器端
<INPUT class="button" id="img3" style="Z-INDEX: 109; LEFT: 416px; WIDTH: 16px; POSITION: absolute; TOP: 40px; HEIGHT: 16px" onclick="select_apply()" type="image" src="../../image/button/date.gif" runat="server">
子页面:
在你需要关闭子页面并回传值的时候调用下面这句话
Response.Write("<script>window.returnValue=回送的值;window.close();</script>");
详细点说吧
首先,给Button加个客户端事件方法为this.Button.Attributes["OnClick"] = "javascript:return click();";
在html页里添加
function Choose()
{
var re = window.showModalDialog("windows2.aspx","","dialogWidth:550px;dialogHeight:400px");
if(re==1)
{
__doPostBack("Button2","")
}
}
windows2.aspx是你弹出的子窗口,Button2是父窗口里的一个隐藏按钮,是子窗口关闭后的触发的事件,写父窗口值用。
子窗口里确定按钮事件如下
Conform_Click(object sender, System.EventArgs e)
{
Session["1"] = sTextBox1.Text.ToString();
Session["2"] = sTextBox2.Text.ToString();
Response.Write(@"<script>window.returnValue=1;window.close();</script>");
}
在父页面里添加隐藏的按钮btton2的事件
Button2_Click(object sender, System.EventArgs e)
{
TextBox1.Text = Session["1"].ToString();
TextBox2.Text = Session["2"].TsString();
}
完毕,够详细的了,
http://dotnet.aspx.cc/ShowDetail.aspx?id=49ML4AO8-5PB3-4KNY-NJZD-LJOIOXV4M1X4
up
session
up
只能UP了~~~~有这么多热心人~~~
ding
ding
up
heip you up! up and up!