本文介绍了在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

推荐答案

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..



这篇关于在ASP .NET Web应用程序中将数据从一种形式传递到另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 23:01