View Single Post
  #4 (permalink)  
Old February 19th, 2012, 08:31 AM
shariful shariful is offline
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2010
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts

No, it’s still not fixed yet Imar. Let me give little bit more information about this problem.
In one of my pages, SignUpDetail.aspx, I’ve added a DropDownList control called ‘ddlCounty’, which is using a connection string called ‘MyPeopleConnectionString1’ to connect to a SQL 2005 Database table called ‘dbo.Countries’. At run-time the ‘ddlCountry’ displays all the country names as expected. Now, in the page’s code behind file, I’m trying to read the selected country name and assigned it to a string variable. BUT the variable is always getting the Index value of the selected country, NOT the actual name of the country. Part of my code is as below:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

_uName = CollectUserName()
_uDetail = CollectUserContactDetails()

If (_uBLL.InsertUserInformation(_uName, _uDetail)) = True Then
Response.Write("Insertion Successful")
End If

End Sub

Private Function CollectUserName() As UserName

Dim un As New UserName

un.UserId = _strUserId
un.Title = Me.ddlTitle.Text
un.FirstName = Me.txtFirstName.Text.Trim()
un.MiddleName = Me.txtMiddleName.Text.Trim()
un.Surname = Me.txtSurname.Text.Trim()
un.Nickname = Me.txtNickname.Text.Trim()
un.Gender = Me.ddlGender.Text

Return un

End Function

Private Function CollectUserContactDetails() As UserContactDetail

Dim ucd As New UserContactDetail

ucd.UserId = _strUserId
ucd.HouseNameOrNumber = Me.txtHouseNumber.Text.Trim()
ucd.Street = Me.txtStreet.Text.Trim()
ucd.Town = Me.txtTown.Text.Trim()
ucd.County = Me.txtCounty.Text.Trim()
ucd.Postcode = Me.txtPostcode.Text.Trim()
ucd.Country = Me.ddlCountry.SelectedValue ' NOT WORKING
ucd.HomeTelephoneNumber = Me.txtHomeTelephone.Text
ucd.WorkTelephoneNumber = Me.txtWorkTelephone.Text
ucd.MobileNumber = Me.txtMobileNumber.Text

Return ucd
End Function
Hope this will give you bit clearer picture of my problem.