PostBack and Main Window

G

Guest

Dear all,

I have a web form which opens a new window when a button is clicked . I use
java
script to open a new window. In this window I have several text boxes in
which a
user fills his details and presses save button.when a save button is pressed
the data
is inserted in the database and New window closes.
I have written the following code in the NEW WINDOW:

btnAdd_Clicked ()

(Insertion takes place over here)
Response.Write("<script
language='javascript'>window.opener.document.forms(0).submit();</script>")
Response.Write("<script language='javascript'>window.close();</script>")

which means that the Main window must display the recent data entered in the
database which it does smoothly.Now I have a dropdownbox on the Main window
which lists the ID numbers of all the users.and have a search button which
upon pressing searches the records of the user which is selected in the
dropdown box.
The problem is that when a new user is entered from the pop up window I can
see
his ID in the dropdown box but cannot search anything based on his ID. If I
press search button it searches the record of the first person and not the
most
recent added person. I know that this is happening because of POSTBACK .But
I dont know how to call a POSTBACK method from a new window into the MAIN
window. I dont know but can we call the POSTBACK method after the above 2
lines of code in the btnAdd of new window.

I am really confused please help me in this case.

Any help much appreciated.

cheers,
Sunil Sabir
 
J

Jie

Do somehting like this

1. Add a hidden linkbutton on your main page
2. Write the script likes the following to do the post back to the main
window
strJavaScript = "<script language='javascript'>
window.opener.execScript(""__doPostBack('LinkButtonHiddenName','')"",""JavaS
cript"");window.close();</script>"

Page.RegisterStartupScript("CreateNewUser", strJavaScript)

3. Handle the click event of 'LinkButtonHiddenName' in the main window. You
can post back the new created userid to the main window and reload your
dropdown list and select the newly created userid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top