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

Populate Text Box After PostBack

Status
Not open for further replies.

bubberz

Programmer
Dec 23, 2004
117
US
I have a text box, txtGroup, that I'm trying to insert with a ddl value.
When the page loads, I have a label, lblLoad, that will populate with the correct ddl value. When there is a PostBack, there's another label, lblPostBack, that populates with the PostBack value from the ddl. What I can't figure out is how to get the TextBox to reflect the value from the PostBack in the lblPostBack control.
I've placed my code in the Page_Prerender handler:


If (Not Page.IsPostBack) Then
txtGroup.Text = lblLoad.Text.ToString
Else
txtGroup.Text = lblPostBack.Text.ToString
End If

I can see the information I want in the labels, I just can't get the textbox to show it.
 
why not assign the value to the lblpostback, when the ddl__SelectedIndexChanged event Fires?

something like this

Private Sub ddlUploadProcess_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlUploadProcess.SelectedIndexChanged
If ddlUploadProcess.SelectedValue <> "" Then

lblPostback.text = ddlUploadProcess.SelectedValue.tostring
End If
End Sub

George Oakes
Check out this awsome .Net Resource!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top