public void InnerRender() { ContentStart.Text = ""; ContentFinish.Text = ""; String displayText = String.Concat(Value); try { displayText = Value == null ? EmptyText : String.Format(new ObjectFormatter(), String.Concat(DisplayFormat) == "" ? "{0}" : DisplayFormat, Value); } catch { } if (TextOnly) { ContentStart.Text += String.Format(@"<span><a href=""javascript:;"" onclick=""{1}"">{0}</a></span>", displayText, Handler.GetScript("'Link=true'")); } else { ContentStart.Text += String.Format(@" <div class=""btn-group"" role=""group"" aria-label=""...""> <button type=""button"" class=""btn btn-default btn-sm"" onclick=""{0}""> <span data-bind=""label"">{1}</span> <span class=""caret""></span> </button> </div>{2}" , Handler.GetScript("'Show=true'") , displayText , Buttons.InnerRender()); } }
public String InnerRender() { Content.Text = ""; if (TextOnly) { Content.Text += String.Format(@"<span>{0}</span>", (SelectedItem != null) ? SelectedItem.Text : ""); } else { if (SortByText) { Items.List = Items.List.OrderBy(f => f.Text).ToList(); } Content.Text += String.Format(@"<input type='hidden' value='{0}' name='{1}'/>", HttpUtility.UrlEncode(String.Concat(Value)), ClientID + "_value"); if (Items.Count > DropDownMaxCount) { Content.Text += String.Format(@" <div class=""btn-group""> <button type=""button"" class=""btn btn-default btn-sm dropdown-toggle"" onclick=""var elems = $(this).parent().find('.modal').modal();""> <span data-bind=""label"">{0}</span> <span class=""caret""></span> </button>{2} <div class=""modal fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true""> <div class=""modal-dialog""> <div class=""modal-content""> <div class=""modal-header""> <h4>{1}</h4> </div> <div class=""modal-body""> <div class=""table-responsive"" style=""max-height: 480px; overflow: auto""> <table class=""table table-hover""> ", Value == null ? EmptyText : SelectedItem == null ? EmptyText : SelectedItem.Text , EmptyText , Buttons.InnerRender()); foreach (XafBootstrapDropdownItem item in Items.List) { String changeEvent = String.Format(@"onclick=""$(this).parents('.modal').modal('hide'); window.DataChanged=true; {0};""", Handler.GetScript(String.Format("'NewValue={0}'", item.Index))); Content.Text += String.Format(@" <tr><td {1} style='vertical-align: middle'>{2}{0}{3}</td></tr>" , item.Text , changeEvent , String.Concat(item.ImageUrl) != "" ? String.Format("<img class='img-circle' style='max-width: {0}px; max-height: {1}px;' src='{2}'/> ", Items.ItemImageWidth, Items.ItemImageHeight, item.ImageUrl) : "" , String.Concat(item.Hint) != "" ? String.Format("<br><span style=' opacity: 0.6;'>{0}</span>", item.Hint) : "" ); } Content.Text += String.Format(@" </table> </div> </div> <div class=""modal-footer""> <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"">{0}</button> </div> </div> </div> </div> </div> ", XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "Cancel")); } else { Content.Text += String.Format(@" <div class=""btn-group""> <button type=""button"" class=""btn btn-default btn-sm dropdown-toggle"" data-toggle=""dropdown""> <span data-bind=""label"">{0}</span> <span class=""caret""></span> </button>{1} <ul class=""dropdown-menu"" role=""menu""> " , Value == null ? EmptyText : SelectedItem == null ? EmptyText : SelectedItem.Text , Buttons.InnerRender()); foreach (XafBootstrapDropdownItem item in Items.List) { String changeEvent = String.Format(@"onclick="";window.DataChanged=true;{0};""", Handler.GetScript(String.Format("'NewValue={0}'", item.Index))); Content.Text += String.Format(@" <li role=""presentation""><a role=""menuitem"" tabindex=""-1"" {1}><span class=""text-success"">{0}</span>{2}</a></li>" , item.Text , changeEvent , (String.Concat(item.Hint) != "" ? "<br>" + item.Hint : "")); } Content.Text += @" </ul> </div> "; } } return(Content.Text); }