Click here to Skip to main content
16,010,022 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

MIDL
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
Posted
Updated 22-May-11 21:37pm
v3

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..
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900