Dear All,
I have a web form which has a link and a drop down box. when I press a
link
a pop up window opens. This window has a lot of TEXTBOXES and a Save
button. When I fill the TextBoxes and press save the POP UP window closes.
Actually this POP UP window is a record of an employee. so basically I am
filling the personal information of the employee. What I want is that
when I
press save Button the POP UP window must close. And It should display the
ID number of recently entered Employee in the dropdown box. Below is my
Code
behind the save button in the POP UP window:
Dim strJavaScript As String
strJavaScript = "<script
language='javascript'>window.opener.execScript(""_ _doPostBack('LinkButton1','')"",""JavaScript"");wi ndow.close();</script>"
Page.RegisterStartupScript("", strJavaScript)
I have an invisible LINKBUTTON1 on the web form which has the dropdownbox.
Now in the load event of web form is the following code:
If Not IsPostBack
Dim conHcpMain As SqlConnection
Dim dtrHcpMain As SqlDataReader
Dim cmdIDs As SqlCommand
Dim dtrIDs As SqlDataReader
cmdIDs = New SqlCommand("Select * from HCP_IDs", conHcpMain)
dtrIDs = cmdIDs.ExecuteReader()
dropID.DataSource = dtrIDs
dropID.DataTextField = "Hcp_Id"
dropID.DataValueField = "Hcp_Id"
dropID.DataBind()
dtrIDs.Close()
End if
This Code actually displays IDs of all the Employees in the Database.
And in the
click event of the LINKBUTTON1 I have the same code as above but without a
post back:
Dim conHcpMain As SqlConnection
Dim dtrHcpMain As SqlDataReader
Dim cmdIDs As SqlCommand
Dim dtrIDs As SqlDataReader
cmdIDs = New SqlCommand("Select * from HCP_IDs", conHcpMain)
dtrIDs = cmdIDs.ExecuteReader()
dropID.DataSource = dtrIDs
dropID.DataTextField = "Hcp_Id"
dropID.DataValueField = "Hcp_Id"
dropID.DataBind()
dtrIDs.Close()
When I add a record through a POP UP WINDOW it adds it perfectly into the
database. but it doesnt show the recently added record in the dropdownbox
Any help would be greatly appreciated.
cheers,
Sunil Sabir