Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将文本框中的信息发布到其他解决方案上的另一个文本框_C#_Javascript_Jquery_Asp.net_Sql Server - Fatal编程技术网

C# 将文本框中的信息发布到其他解决方案上的另一个文本框

C# 将文本框中的信息发布到其他解决方案上的另一个文本框,c#,javascript,jquery,asp.net,sql-server,C#,Javascript,Jquery,Asp.net,Sql Server,以下是我需要做的事情(在ASP.NET中): 解决方案A、项目A、页面A将有一个文本框和一个打开另一个页面的链接。另一个页面是解决方案B、项目B、页面B的一部分。页面B将有一个文本框和一个提交按钮。单击“提交”将关闭返回A页的窗口,将B页文本框中的文本放入A页的另一个文本框中 我可能可以将文本框的值存储到SQL Server中,然后检索它,但我希望有另一种更好的方法 任何帮助都会非常有用,谢谢 使用以下各项:ASP.NET、C#、JavaScript、jQuery、SQL Server、HTML

以下是我需要做的事情(在ASP.NET中):

解决方案A、项目A、页面A将有一个文本框和一个打开另一个页面的链接。另一个页面是解决方案B、项目B、页面B的一部分。页面B将有一个文本框和一个提交按钮。单击“提交”将关闭返回A页的窗口,将B页文本框中的文本放入A页的另一个文本框中

我可能可以将文本框的值存储到SQL Server中,然后检索它,但我希望有另一种更好的方法

任何帮助都会非常有用,谢谢


使用以下各项:ASP.NET、C#、JavaScript、jQuery、SQL Server、HTML、CSS等

我认为您可以通过使用查询参数轻松实现这一点。

页面B
上,在按钮的
单击事件期间,设置会话变量:

Session["TextBoxB"] = textBoxB.Text;
然后在
页面A
中的
加载
,添加代码以查找它:

if (Session["TextBoxB"] != null)
{
    // it has a value so use it
    textBoxA.Text = Session["TextBoxB"];
}

如果您使用jQuery模式窗口显示页面B,并且在页面B中有一个触发器将数据发送回页面a上的元素,该怎么办

A页:

<div id="page_a">
    <form>
        <input name="page_a_box" id="page_a_box">
    </form>
</div>
<div id="container_for_page_b">
</div>

<script>
$.ajax({
    url: 'page_b.asp'
    ,cache: false
    ,dataType: 'html'
    ,success: function(data){
        // fill the container with html data
        $('#container_for_page_b').html(data);

        // invoke jQuery UI's dialogue window
        $('#container_for_page_b').dialog();
    }
});


</script>

$.ajax({
url:“page_b.asp”
,缓存:false
,数据类型:'html'
,成功:函数(数据){
//用html数据填充容器
$('u#container_for_page_b').html(数据);
//调用jQueryUI的对话窗口
$(“#容器_用于_页面_b”).dialog();
}
});
B页:

<div id="page_b">
    <form onSubmit="$('#page_a_box').val($('#page_b_box').val()); $('#container_for_page_b').dialog('destroy');">
        <input name="page_b_box" id="page_b_box">
        <input type="submit" value="submit">
    </form>
</div>

查看以下内容了解更多想法:

我猜你的意思是他们在两个不同的域上?同一个域。例如:?->?您可以通过JavaScript在两个窗口之间进行通信。如果你用
窗口打开窗口。打开
你可以通过
窗口与父窗口进行通信。根据你的评论,如果它们在同一个域中,你可以用cookies来处理。如果页面需要像这样共享数据,它们真的不应该在单独的项目中(当然,这是假设你可以控制这件事——如果不是这样的话,就忽略不计)。如果它们在同一个项目中,您可以将其中一个转换为用户控件,该控件可以嵌套在第一个页面中。您能举个例子吗?我想他的意思是将其存储在表中,然后在原始页面上检索。这是一种可能性,但我已经知道。@user2642212,您能详细说明原因吗?