Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh combo box

Status
Not open for further replies.

ksbigfoot

Programmer
Joined
Apr 15, 2002
Messages
856
Location
CA
Currently I am using an ASP page and a com object.
Before I switch to ASP.NET, I am wondering if this can be done in ASP.NET.
In my ASP pages, the user clicks on submit and the information from this page is posted back onto itself. I then call a COM object to run.
The COM object will take up to 4 minutes sometimes to complete running.
For simplicity sake lets say the COM object inserts one record into a table in my database.
In my ASP page, I have a combo box that pulls the records from the same table.

Is there a way in ASP.NET to refresh this combo box once the table gets updated with more records or once the COM object finishes running?
 
if you keep it in the same sub it will do whatever you want it to do in between postbacks. by same sub i mean you can still call other subs too

SIMPLIFIED example

html
<asp:DropDownList id=ddlChangeme runat=server />
<asp:Button id=btnPush runat=server text="Push Me"
onClick=pushed_Code />

vb code
Sub Page_Load()
If Not Page.IsPostBack Then
'first time load
FillDDL()
End If
End Sub

Sub FillDDL()
'TO DO Get Connection String to conString variable
' and your sql statement or stored proc
Dim objCon As New SqlConnection(conString)
Dim objComm As New SqlCommand(sSQL, objCon)
Dim da As New SqlDataAdapter(objComm)
Dim ds As New DataSet()
da.Fill(ds)
ddlChangeMe.DataSource = ds
ddlChangeMe.DataBind()
objCon.Close()
End Sub

Sub pushed_Code(sender As Object, e As EventArgs)
'Do you COM thing here
'once youve done it call ddl sub again
FillDDL()
End Sub



 
Yes there is and there are a few methods that you could use. Check out this article for some information on how to do it:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top