示例#1
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            List <SelectionItem <string> > states = await CAProvince.ReadProvincesListAsync();

            if (model == null)
            {
                model = "";
            }
            string state = (from s in states where string.Compare(s.Value, model.ToUpper(), true) == 0 select s.Text).FirstOrDefault();

            return(HE(state));
        }
示例#2
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            List <SelectionItem <string> > states = await CAProvince.ReadProvincesListAsync();

            bool useDefault = !PropData.GetAdditionalAttributeValue <bool>("NoDefault");

            if (useDefault)
            {
                states = (from s in states select s).ToList();//copy
                states.Insert(0, new SelectionItem <string> {
                    Text    = __ResStr("default", "(select)"),
                    Tooltip = __ResStr("defaultTT", "Please make a selection"),
                    Value   = "",
                });
            }
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, states, "yt_caprovince"));
        }