Record Not Updated in DropDownBox

G

Guest

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"");window.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
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top