return new SelectList(new[] { "Please choose an option." });
In the preceding statement, how can I add a value=string.empty for the text value above?
Thanks, rodchar
The following is what works for me, however, is there a more consise way to write this?
return new SelectList(new[] { "Please choos开发者_如何学编程e." }
                .Select(a => new { value = "", text = a.ToString() }), "value", "text", "");
In General, I have been using something like this, you can customize this for your purpose (particularly the values part).
<% var values = Enumerable.Range(1,10); %> <!-- values from 1 to 10 -->
<%= Html.DropDownList("DropDownId",  
          values.Select(x => new SelectListItem { Text = x.ToString(), Value = x.ToString()})) %>
For your case, I think you found the answer, just wanted to share how I use it.
Thanks
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论