Dictionary as DropDownList Data Source
MyList.DataSource = myListOptions;
MyList.DataTextField = "Value";
MyList.DataValueField = "Key";
MyList.DataBind();
It took me some rummaging to realize that you use the actual strings "Value" and "Key," so I hope this post comes in handy for someone else in the future (even if it's me).
Labels: code

1 Comments:
Thank you!!! Saved me a few lines of code and a ton of frustration.
Post a Comment
Links to this post:
Create a Link
<< Home