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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate a textbox without reloading the page.

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
0
0
US
Hello,

I have a listbox, a textbox, and a button. The button populates the textbox with the selected item & value of the listbox. As below:

Protected Sub GetVariables_Click(ByVal sender As Object, ByVal e As EventArgs) Handles GetVariables.Click
Me.txtLetter.Text = lstNames.SelectedItem.ToString & lstNames.SelectedValue.ToString
End Sub


The problem I have, is that when doing this it reloads the page each time. Any way around this?

Thanks,
Jason
 
Any server button will cause a postback. If you don't want this to happen, you will have to make an AJAX request using a standart HTML button.
 
ajax still causes a post back. if you want the action to take place purely on the client then you will need to use javascript. jquery makes javascript very simple.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
clarification: ajax still sends a request to the server. postback is specific to webforms.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Jason is correct. You need to use pure javascript to avoid a trip to the server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top