Problem with DropDownList Box....

Results 1 to 3 of 3

Thread: Problem with DropDownList Box....

  1. #1
    ksn Guest

    Default Problem with DropDownList Box....

    hi,<BR>I have declared DropDownList box as follows ::<BR>&#060;asp:DropDownList id=DropDownList1 Runat=server&#062;asp:DropDownList&#062;<BR><BR>No w i am accessing a table(CountryNames) which is having 2 fields(CountryNames and CountryCodes).<BR><BR>Mycode::<BR><BR>strConnectio nString="SERVER=myserver;UID=sa;PWD=password;APP=M icrosoft (R) Developer Studio;DATABASE=temp"<BR><BR>myConnection = New SQLConnection(strConnectionString)<BR><BR>myComman d = New SQLDataSetCommand("Select * from CountryNames", myConnection)<BR><BR>ds = New DataSet<BR><BR>myCommand.FillDataSet(ds,"CountryNa mes")<BR>test1 = DS.Tables(0).Rows.All<BR>Dim values as ArrayList= new ArrayList()<BR>For Each item In test1<BR> values.Add(trim(item.ItemArray.GetValue(0)))<BR>Ne xt<BR><BR>DropDownList1.DataSource = values<BR>DropDownList1.DataBind<BR><BR>I am populating the DropDownList box with Country far it is working fine but my problem is i want to set the value to my second database field(Country codes) instead of Country Names with which i am Populating the list box..<BR><BR>Example::When i am looking the source code from browser its looking like this<BR> &#060;option value="United States Of America"&#062;United States Of America&#060;/option&#062;<BR>but i want like this<BR><BR>&#060;option value="usa"&#062;United States Of America&#060;/option&#062;<BR>where "usa" is the other database feild..<BR><BR>Can any one of u help me out..please be clear in ur explanation..<BR>Thanx in Advance...<BR><BR><BR>

  2. #2
    Rob Guest

    Default RE: Problem with DropDownList Box....

    This has the answer<BR>

  3. #3
    ksn Guest

    Default RE: Problem with DropDownList Box....

    Hi Rob<BR> Than Q very much.It was of Great Help.<BR>Regards<BR>ksn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts