Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: drop down list losing state


Message #1 by "PaddyKelly" <kellypa@z...> on Wed, 12 Feb 2003 11:56:35
hi,

I have a data bound drop down list which populates fine when I submit the 
form (button submit see below)to another page the viewstate doesn't 
contain the correct value -  it is reset to the default 

Private Sub butAddRecord_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles butAdd.Click
' Create a new row for the data set.
Dim rowNew As dsContacts.ContactsRow
rowNew = dsContacts.Contacts.NewContactsRow()
' Add data to the row.
rowNew.ContactID = GetNewContactID()
rowNew.FirstName = txtFirstName.Text
rowNew.LastName = txtLastName.Text
rowNew.Address = txtAddress.Text
rowNew.City = txtCity.Text
rowNew.StateOrProvince = drpStates.SelectedItem.Text
rowNew.PostalCode = txtZip.Text
rowNew.HomePhone = txtHomePhone.Text
rowNew.WorkPhone = txtWorkPhone.Text
rowNew.Notes = txtNotes.Text
rowNew.ContactTypeID = drpContactTypes.SelectedItem.Value <---- value is 
rest doesn't hold state
	.
	.
End Sub

it's based on the chapter 5 lab in the MCSD/MCAD developing web app's 
book. Any help would be greatly appreciated as it's doing my head in !
Message #2 by "Rohit Arora" <rohit_arora@i...> on Thu, 13 Feb 2003 09:39:59 +0530
set viewstate property to true.

Regards
Rohit Arora


-----Original Message-----
From: PaddyKelly [mailto:kellypa@z...]
Sent: Wednesday, February 12, 2003 11:57 AM
To: aspx_beginners
Subject: [aspx_beginners] drop down list losing state


hi,

I have a data bound drop down list which populates fine when I submit the
form (button submit see below)to another page the viewstate doesn't
contain the correct value -  it is reset to the default

Private Sub butAddRecord_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles butAdd.Click
' Create a new row for the data set.
Dim rowNew As dsContacts.ContactsRow
rowNew = dsContacts.Contacts.NewContactsRow()
' Add data to the row.
rowNew.ContactID = GetNewContactID()
rowNew.FirstName = txtFirstName.Text
rowNew.LastName = txtLastName.Text
rowNew.Address = txtAddress.Text
rowNew.City = txtCity.Text
rowNew.StateOrProvince = drpStates.SelectedItem.Text
rowNew.PostalCode = txtZip.Text
rowNew.HomePhone = txtHomePhone.Text
rowNew.WorkPhone = txtWorkPhone.Text
rowNew.Notes = txtNotes.Text
rowNew.ContactTypeID = drpContactTypes.SelectedItem.Value <---- value is
rest doesn't hold state
	.
	.
End Sub

it's based on the chapter 5 lab in the MCSD/MCAD developing web app's
book. Any help would be greatly appreciated as it's doing my head in !


  Return to Index