codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Two dimentional array - Dropdown box  eshwar_gp at 06:06 on Wednesday, April 27, 2005
 

Hi, how can i display data from two dim-array to dropdownlist as first row from array to dropdownlist.value and 2nd row from array todropdownlist.Text

for example
-----------
in page load

protected System.Web.UI.WebControls.DropDownList drpTranslationTo;


string[,] strLanguageList = new string[,]
{
{"en","English"},
{"en-AU","English Australia"},
{"en-BZ" ,"English Belize"},
{"en-CA","English Belize"},
{"en-CB","English Caribbean"},
{"en-IE","English Ireland"},
{"en-NZ","English New Zealand"},
{"en-PH","English Philippines"},
};


drpTranslationTo.DataSource=strLanguageName;
//Here I need to assign the first array value to dropdown Text field and second value to DataValue field

drpTranslationTo.DataTextField;
drpTranslationTo.DataValueField;
drpTranslationTo.DataBind();


Please help me


  Re: Two dimentional array - Dropdown box  jax at 11:23 on Wednesday, September 30, 2009
 

For i As Integer = 0 To strLanguageList.GetLength(0) - 1
dropdownlist1.Items.Add(New ListItem(strLanguageList(i, 1), strLanguageListr(i, 0)))
Next


This will solve your problem. I have checked, its working properly, here 2nd column will work as datatext field and Ist value will work as datavalue field.

Jax








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• C++
• Re: refresh parent after closing pop up window
• Dynamic Insertion
• Date and Time function around the world???
• Significant Factors
• Perl array access
• Re: huffman encoding and decoding in C++...
• Perl One Liner: Replace {(
• Re: html including php, accessing the functions


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009