ASP. NET MVC page value--DropDownList

Source: Internet
Author: User

Background Pass Value

            list<configparaminfo> paramlist = Configparambll.getmodellist ("and parentid=1");            viewdata["UserState"] = new SelectList (paramlist, "value", "name");

Front Page

@Html. DropDownList ("userstate", viewdata["userstate"] as SelectList, "--Please select--", new {@class = "Form-control input-sm"})

                //Abstract:         //     use the specified HTML Helper, the form linked fields, the specified list items, the options tag, and the specified HTML, to return a single select item. ////        Parameters:////HtmlHelper://     This method is an expanded HTML Helper. ////   Name:        //     linked fields-bit name of the form to be returned. /////   selectlist: A        collection of     System.Web.Mvc.SelectListItem objects that are used to fill in the drop-down checklist. /////        Optionlabel://     Preset blank text for the purpose. This can be null. ////   htmlattributes:        //     object containing the HTML that is to be set for the item. ////        Fax:         //     HTML Select item, where each item in the list contains an option sub-item. /////        Exceptions:/         /   System.ArgumentException:        //     The name parameters are null or blank. Public        static mvchtmlstring DropDownList (This htmlhelper htmlhelper, string name, Ienumerable<selectlistitem > SelectList, String Optionlabel, Object htmlattributes);

  

ASP. NET MVC page value--DropDownList

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.