Home > DeveloperSection > Forums > Dropdownlist DataValueField in asp.net c#
jayprakash sharma
jayprakash sharma

Total Post:117

Points:821
Posted on    January-06-2015 10:43 PM

 ASP.Net C#  Dropdown 
Ratings:


 1 Reply(s)
 913  View(s)
Rate this:

I have multiple items in asp drop down list and I want to set its DataValueField to one by one using loop. I did it as follow.

int cnt = ddl2.Items.Count;

 

for(int j=0;j<cnt;j++)

{

    string val = ddl2.Items[j].ToString();

    int datafieldid = // want datavaluefield id here

}

Please help.

Thanks.

 



Pravesh Singh
Pravesh Singh

Total Post:101

Points:709
Supported
Posted on    January-06-2015 11:00 PM

int cnt = ddl2.Items.Count;

 

for(int j = 0;j < cnt ; j++)

{  

    string val = ddl2.Items[j].ToString();

    int datafieldid =  ddl2.Items[j].value // want datavaluefield id here

}


Don't want to miss updates? Please click the below button!

Follow MindStick