2 probably easy DropDownList questions

Results 1 to 2 of 2

Thread: 2 probably easy DropDownList questions

  1. #1
    Join Date
    Dec 1969

    Default 2 probably easy DropDownList questions

    I hope someone can answer these two questions, I&#039;d really appreciate it. You&#039;ll probably find them rather basic.<BR><BR>1. When I create a DropDownList as below, it appears sorted in no particular order (7,4,1,5,6,3,2..something like that). How can I sort it according to the order below, as I added them to hastable (1,2,3...)?<BR>2. More importantly, if I want to retrieve an existing record into a form, what code should I write to assign a value (from db, from existing dropdownlist values, of course) to my DropDownList? <BR><BR>Thank you so much, sorry to bother you all.<BR><BR>--<BR><BR>&#060;ASP:DROPDOWNLIST id="ItemType" Width="60px" Runat="server" cssClass="iClassInp"&#062;&#060;/ASP:DROPDOWNLIST&#062;<BR><BR>Dim tabFeaturedTypes As New Hashtable(7)<BR><BR>tabFeaturedTypes.Add("1=random articles from any section", 1)<BR>tabFeaturedTypes.Add("2=random articles from a section", 2)<BR>tabFeaturedTypes.Add("3=highest rated", 3)<BR>tabFeaturedTypes.Add("4=external links", 4)<BR>tabFeaturedTypes.Add("5=most viewed", 5)<BR>tabFeaturedTypes.Add("6=most emailed", 6)<BR>tabFeaturedTypes.Add("7=most printed", 7) <BR><BR>FeaturedType.DataSource = tabFeaturedTypes<BR>FeaturedType.DataValueField = "Value"<BR>FeaturedType.DataTextField = "Key"<BR>&#039;FeaturedType.SelectedIndex = 0 <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: 2 probably easy DropDownList questions

    Good day..<BR> I feel that we have to sort it ourselves.. if u getting it from the table... why not try retreiving from the table in the sorted format.. ! <BR><BR>To fill from table :<BR><BR>fill it into a dataset<BR>Assign the datasource , datamember and datatextfield !<BR><BR>Happy Scripitng !<BR>Sri !

Posting Permissions

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