在ASP .NET Web应用程序中将数据从一种形式传递到另一种形式 [英] Passing Data From One Form to Another in asp .net web apps
本文介绍了在ASP .NET Web应用程序中将数据从一种形式传递到另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hii
我想将价值从第二种形式转变为第一种形式
我正在打开搜索表单以过滤我的数据&从那一个获取特定数据
请给我建议,以将数据转换为我的第一表格
我正在使用
从1st打开2nd表单
Javascript
Hii
I want to take value from 2nd form to 1st
i am opening Search form to filter my data & get Specific data from that one
Plz give me suggetion for geting that data to my 1st form
I am Opening 2nd form from 1st using
Javascript
string script = "@SCRIPT>window.open";
script = script + "('FindDocument.aspx?str=" + str + "','ChildForm','status=yes,toolbar=no, location = center ";
script = script + ",menubar=no,titlebar=yes,location=center,resizable=yes,scrollbars=yes ,width = 410 ,height = 410 ,')@/SCRIPT>";
Page.RegisterClientScriptBlock("OpenChild", script.Replace("@", "<"));
我不知道我的问题
在此先谢谢您
i am not getting idea for my problem
Thanks in advance
推荐答案
我认为您已经发送了带有页面引用的查询字符串,因此您应该将一些基本关键字作为搜索参考词发送,并且您必须抓住在已重定向的其他页面的Page_Load()事件中键入的键...
在页面中....
FindDocument.aspx
I think you have sent query string with the page reference so you should send some basic key(s) as a search keayword and you have to catch that keys in Page_Load() event of other page on that you have redirected...
In the page.....
FindDocument.aspx
protected void Page_Load(object sender, EventArgs e)
{
if(Request["str"] != null)
{
string key = Convert.ToString(Request["str"]);
// here you have got the key that you have sent before as a querystring...
// Now add here your basic search functionality...
// you can fire a query here like this......
string query = @"Select * from tableName WEHRE keyfield=@keyfield";
// adding a parameter...
SqlCommand cmd = new SqlCommand(query,con); // where con is a object of SqlConnection class that you have to Initiate before..
cmd.Parameter.Add("@keyfield",key);
SqlDataReader dr = cmd.ExecuteReader();
//Now, here you got the data that you want.. display it in proper control like Gridview or DataList or etc...
}
}
希望对您有帮助.....
谢谢.
I hope this may help you.....
Thanks..
尝试以下javascript函数:
函数PassBackValue(val)
{
opener.window.getElementById(''your_control_name'').value = val;
}
在这里,your_control_name可能是您要在弹出窗口(或第二页)关闭时更新的控件.在某个适当的事件上调用此函数.
Try below javascript function:
function PassBackValue(val)
{
opener.window.getElementById(''your_control_name'').value = val;
}
Here your_control_name may be a control which you want to update on the pop-up (or 2nd page) close. Call this function on some appropriate event.
这篇关于在ASP .NET Web应用程序中将数据从一种形式传递到另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文