public MvcHtmlString JQDropDownList(JQDropDownList dropDownList, string id) { JQDropDownListRenderer jQDropDownListRenderer = new JQDropDownListRenderer(dropDownList); dropDownList.ID = id; return(MvcHtmlString.Create(jQDropDownListRenderer.RenderHtml())); }
public JQDropDownListRenderer(JQDropDownList model) { this._model = model; }
public JQDropDownListRenderer(JQDropDownList model) { this._model = model; }
private string GetStartupOptions() { StringBuilder stringBuilder = new StringBuilder(); JQDropDownList model = this._model; DropDownListClientSideEvents clientSideEvents = this._model.ClientSideEvents; stringBuilder.AppendFormat("id:'{0}'", model.ID); stringBuilder.AppendFormat(",width:{0}", model.Width.ToString()); stringBuilder.AppendFormat(",height:{0}", model.Height.ToString()); if (model.DropDownWidth.HasValue) { stringBuilder.AppendFormat(",dropDownWidth:{0}", model.DropDownWidth.ToString()); } if (model.TabIndex != 0) { stringBuilder.AppendFormat(",tabIndex:{0}", model.TabIndex.ToString()); } if (model.Items.Count > 0) { stringBuilder.AppendFormat(",items:{0}", new JavaScriptSerializer().Serialize(model.SerializeItems(model.Items))); } if (!string.IsNullOrEmpty(model.ItemTemplateID)) { stringBuilder.AppendFormat(",itemTemplateID:'{0}'", model.ItemTemplateID); } if (!string.IsNullOrEmpty(model.HeaderTemplateID)) { stringBuilder.AppendFormat(",headerTemplateID:'{0}'", model.HeaderTemplateID); } if (!string.IsNullOrEmpty(model.FooterTemplateID)) { stringBuilder.AppendFormat(",footerTemplateID:'{0}'", model.FooterTemplateID); } if (!string.IsNullOrEmpty(model.ToggleImageCssClass)) { stringBuilder.AppendFormat(",toggleImageCssClass:'{0}'", model.ToggleImageCssClass); } if (!string.IsNullOrEmpty(clientSideEvents.Show)) { stringBuilder.AppendFormat(",onShow:{0}", clientSideEvents.Show); } if (!string.IsNullOrEmpty(clientSideEvents.Hide)) { stringBuilder.AppendFormat(",onHide:{0}", clientSideEvents.Hide); } if (!string.IsNullOrEmpty(clientSideEvents.MouseOut)) { stringBuilder.AppendFormat(",onMouseOut:{0}", clientSideEvents.MouseOut); } if (!string.IsNullOrEmpty(clientSideEvents.MouseOver)) { stringBuilder.AppendFormat(",onMouseOver:{0}", clientSideEvents.MouseOver); } if (!string.IsNullOrEmpty(clientSideEvents.Select)) { stringBuilder.AppendFormat(",onSelect:{0}", clientSideEvents.Select); } if (!string.IsNullOrEmpty(clientSideEvents.Select)) { stringBuilder.AppendFormat(",onInitialized:{0}", clientSideEvents.Initialized); } if (!string.IsNullOrEmpty(clientSideEvents.Select)) { stringBuilder.AppendFormat(",onKeyDown:{0}", clientSideEvents.KeyDown); } return(stringBuilder.ToString()); }