public override void WriteInitializationScript(System.IO.TextWriter writer) { IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer); objectWriter.Start(); objectWriter.AppendObject("val", Value); objectWriter.Append("step", IncrementStep); objectWriter.AppendObject("minValue", MinValue); objectWriter.AppendObject("maxValue", MaxValue); objectWriter.Append("symbol", PercentSymbol); objectWriter.Append("digits", DecimalDigits); objectWriter.Append("separator", DecimalSeparator); objectWriter.AppendNullableString("groupSeparator", NumberGroupSeparator); objectWriter.Append("groupSize", NumberGroupSize); objectWriter.Append("positive", PositivePatternIndex); objectWriter.Append("negative", NegativePatternIndex); objectWriter.Append("text", EmptyMessage); objectWriter.Append("type", "percent"); ClientEvents.SerializeTo(objectWriter); objectWriter.Complete(); base.WriteInitializationScript(writer); }
public override void WriteInitializationScript(System.IO.TextWriter writer) { IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer); objectWriter.Start(); objectWriter.AppendObject("val", this.Value); objectWriter.AppendObject("step", this.IncrementStep); objectWriter.AppendObject("minValue", this.MinValue); objectWriter.AppendObject("maxValue", this.MaxValue); objectWriter.Append("digits", this.DecimalDigits); objectWriter.Append("separator", this.DecimalSeparator); objectWriter.AppendNullableString("groupSeparator", this.NumberGroupSeparator); objectWriter.Append("groupSize", this.NumberGroupSize); objectWriter.Append("negative", this.NegativePatternIndex); objectWriter.Append("text", this.EmptyMessage); objectWriter.Append("type", "numeric"); var inputAttributes = new Dictionary <string, string>(); this.InputHtmlAttributes.Each(x => inputAttributes.Add(x.Key, x.Value.ToString())); objectWriter.AppendObject("inputAttributes", inputAttributes); ClientEvents.SerializeTo(objectWriter); objectWriter.Complete(); base.WriteInitializationScript(writer); }
private void SerializeProperties(IClientSideObjectWriter objectWriter) { objectWriter.Append("orientation", Orientation, SliderOrientation.Horizontal); objectWriter.Append("tickPlacement", TickPlacement, SliderTickPlacement.Both); objectWriter.AppendObject("smallStep", SmallStep); objectWriter.AppendObject("largeStep", LargeStep); objectWriter.AppendObject("minValue", MinValue); objectWriter.AppendObject("maxValue", MaxValue); objectWriter.Append("enabled", Enabled, true); Settings.SerializeTo("tooltip", objectWriter); }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (!IsDefault) { writer.AppendObject(key, ToJson()); } }
public static void SerializeTo <T>(this IGridDetailView <T> detailView, string key, IClientSideObjectWriter objectWriter) where T : class { if (detailView.ClientTemplate.HasValue()) { var json = new Dictionary <string, object>(); json["template"] = Regex.Replace(detailView.ClientTemplate, @"data-val-regex-pattern=\\""(.*?)\\""", (Match match) => { return(@"data-val-regex-pattern=\\""" + new JavaScriptSerializer().Serialize(match.Groups[1].Value).Trim('"') + @"\\"""); }) .Replace("%", "%25") .Replace("\\\\\\\"", "%5c%5c%22") .Replace("\\\"", "%5c%5c%22") .Replace("\"", "%22") .Replace("'", "%27") .Replace("\\'", "%27") .Replace("<", "%3c") .Replace(">", "%3e") .Replace("\\u003c", "%3c") .Replace("\\u003e", "%3e") .Replace("\\r", "%0d") .Replace("\r", "%0d") .Replace("\n", "%0A") .Replace("\\n", "%0A") .Replace("\t", "%09") .Replace("\\t", "%09"); objectWriter.AppendObject(key, json); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { var urlBuilder = grid.UrlBuilder; var urls = new Dictionary <string, string>(); if (Select.HasValue() || (SerializeEmptySelectUrl && !Select.HasValue())) { urls["selectUrl"] = Encode(urlBuilder.Url(Select)); } if (Insert.HasValue()) { urls["insertUrl"] = Encode(urlBuilder.Url(Insert)); } if (Update.HasValue()) { urls["updateUrl"] = Encode(urlBuilder.Url(Update)); } if (Delete.HasValue()) { urls["deleteUrl"] = Encode(urlBuilder.Url(Delete)); } writer.AppendObject(key, urls); } }
private void SerializeData(string key, IDictionary <string, object> data, IClientSideObjectWriter objectWriter) { if (data.Count > 0) { objectWriter.AppendObject(key, data); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (!Enabled) { return; } var editing = Serialize(); if (editing.Any()) { writer.AppendObject("editing", editing); } if (grid.IsClientBinding) { writer.AppendObject("dataKeys", grid.DataKeys.ToDictionary(dataKey => dataKey.Name, dataKey => (object)dataKey.RouteKey)); if (!grid.IsEmpty) { if (grid.DataProcessor.ProcessedDataSource is IQueryable<AggregateFunctionsGroup>) { IEnumerable<IGroup> grouppedDataSource = grid.DataProcessor.ProcessedDataSource.Cast<IGroup>(); writer.AppendCollection("data", grouppedDataSource.Leaves()); } else { writer.AppendCollection("data", grid.DataProcessor.ProcessedDataSource); } } } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (!Enabled) { return; } var editing = Serialize(); if (editing.Any()) { writer.AppendObject("editing", editing); } if (grid.IsClientBinding) { writer.AppendObject("dataKeys", grid.DataKeys.ToDictionary(dataKey => dataKey.Name, dataKey => (object)dataKey.RouteKey)); } }
private void SerializeDataSource(IClientSideObjectWriter objectWriter) { if (DataBinding.Ajax.Enabled) { DataBinding.Ajax.SerializeTo("dataSource", objectWriter); } else if (DataSource != null) { objectWriter.AppendObject("dataSource", new { data = DataSource }); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Format != "{0}" || !Enabled) { var settings = new Dictionary<string, object>(); settings["enabled"] = Enabled; settings["format"] = Format; writer.AppendObject(key, settings); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Format != "{0}" || !Enabled) { var settings = new Dictionary <string, object>(); settings["enabled"] = Enabled; settings["format"] = Format; writer.AppendObject(key, settings); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { if (EditOnTab) { writer.AppendObject("keyboardNavigation", new { editOnTab = EditOnTab }); } else { writer.Append("keyboardNavigation", Enabled); } } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { if (EditOnTab) { writer.AppendObject("keyboardNavigation", new { editOnTab = EditOnTab }); } else { writer.Append("keyboardNavigation", Enabled); } } }
public override void WriteInitializationScript(System.IO.TextWriter writer) { IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer); objectWriter.Start(); objectWriter.AppendObject("val", this.Value); objectWriter.Append("step", this.IncrementStep); objectWriter.AppendObject("minValue", this.MinValue); objectWriter.AppendObject("maxValue", this.MaxValue); objectWriter.Append("digits", 0); objectWriter.AppendNullableString("groupSeparator", this.NumberGroupSeparator); objectWriter.Append("groupSize", this.NumberGroupSize); objectWriter.Append("negative", this.NegativePatternIndex); objectWriter.Append("text", this.EmptyMessage); objectWriter.Append("type", "numeric"); ClientEvents.SerializeTo(objectWriter); objectWriter.Complete(); base.WriteInitializationScript(writer); }
public static void SerializeTo(this IDropDownBindingSettings instance, string key, IClientSideObjectWriter writer, IDataBoundDropDown component) { if (instance.Enabled) { var url = new Dictionary <string, string>(); if (instance.Select.HasValue()) { url["selectUrl"] = component.UrlGenerator.Generate(component.ViewContext.RequestContext, instance.Select); } writer.AppendObject(key, url); } }
public void SerializeTo(string key, IClientSideObjectWriter writer, IEditorUrlBuilder urlBuilder) { Func <string, string> encoder = url => owner.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var json = new Dictionary <string, string>(); if (Select.HasValue()) { json["selectUrl"] = encoder(urlBuilder.PrepareUrl(Select)); } if (Thumbnail.HasValue()) { json["thumbUrl"] = encoder(urlBuilder.PrepareUrl(Thumbnail)); } if (Image.HasValue()) { json["imageUrl"] = encoder(urlBuilder.PrepareUrl(Image)); } if (Upload.HasValue()) { json["uploadUrl"] = encoder(urlBuilder.PrepareUrl(Upload)); } if (DeleteFile.HasValue()) { json["deleteFileUrl"] = encoder(urlBuilder.PrepareUrl(DeleteFile)); } if (DeleteDirectory.HasValue()) { json["deleteDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(DeleteDirectory)); } if (CreateDirectory.HasValue()) { json["createDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(CreateDirectory)); } if (Filter.HasValue() && Filter != DefaultFilter) { json["filter"] = Filter; } writer.AppendObject(key, json); }
public static void SerializeTo <TSettings>(this IDropDownBindingSettings instance, string key, IClientSideObjectWriter writer, IDataBoundDropDown component) where TSettings : AutoCompleteBindingSettings { if (instance.Enabled) { var url = new Dictionary <string, string>(); if (instance.Select.HasValue()) { url["selectUrl"] = component.UrlGenerator.Generate(component.ViewContext.RequestContext, instance.Select); } writer.AppendObject(key, url); writer.Append("cache", (instance as TSettings).Cache, true); writer.Append("delay", (instance as TSettings).Delay, 200); } }
/// <summary> /// Serializes the binding settings to the specified writer /// </summary> /// <param name="key">The settings key</param> /// <param name="writer">The writer</param> public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { var readUrl = chart.UrlGenerator.Generate(chart.ViewContext.RequestContext, Select); writer.AppendObject(key, new { transport = new { read = new { url = readUrl, type = "POST" } } }); } }
/// <summary> /// Serializes the binding settings to the specified writer /// </summary> /// <param name="key">The settings key</param> /// <param name="writer">The writer</param> public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { var readUrl = chart.UrlGenerator.Generate(chart.ViewContext.RequestContext, Select); writer.AppendObject(key, new { transport = new { read = new { url = readUrl, type = "POST" } } }); } }
/// <summary> /// Serializes the asynchronous uploading settings to the writer. /// </summary> /// <param name="writer">The writer object.</param> public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Save.HasValue()) { Func <string, string> encoder = (string url) => upload.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var config = new Dictionary <string, object>(); config["saveUrl"] = encoder(Save.GenerateUrl(upload.ViewContext, upload.UrlGenerator)); if (SaveField.HasValue()) { config["saveField"] = SaveField; } if (Remove.HasValue()) { config["removeUrl"] = encoder(Remove.GenerateUrl(upload.ViewContext, upload.UrlGenerator)); } config["autoUpload"] = AutoUpload; writer.AppendObject(key, config); } }
public void SerializeTo(string key, IClientSideObjectWriter writer, IEditorUrlBuilder urlBuilder) { Func<string, string> encoder = url => owner.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var json = new Dictionary<string, string>(); if (Select.HasValue()) { json["selectUrl"] = encoder(urlBuilder.PrepareUrl(Select)); } if (Thumbnail.HasValue()) { json["thumbUrl"] = encoder(urlBuilder.PrepareUrl(Thumbnail)); } if (Image.HasValue()) { json["imageUrl"] = encoder(urlBuilder.PrepareUrl(Image)); } if (Upload.HasValue()) { json["uploadUrl"] = encoder(urlBuilder.PrepareUrl(Upload)); } if (DeleteFile.HasValue()) { json["deleteFileUrl"] = encoder(urlBuilder.PrepareUrl(DeleteFile)); } if (DeleteDirectory.HasValue()) { json["deleteDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(DeleteDirectory)); } if (CreateDirectory.HasValue()) { json["createDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(CreateDirectory)); } if (Filter.HasValue() && Filter != DefaultFilter) { json["filter"] = Filter; } writer.AppendObject(key, json); }
public override void WriteInitializationScript(TextWriter writer) { IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTreeView", writer); objectWriter.Start(); if (!defaultEffects.SequenceEqual(Effects.Container)) { objectWriter.Serialize("effects", Effects); } if (!ShowLines) { objectWriter.Append("showLines", ShowLines); } if (ShowCheckBox) { objectWriter.Append("showCheckBox", ShowCheckBox); } if (DragAndDrop.Enabled) { if (DragAndDrop.DropTargets.HasValue()) { var dragAndDropOptions = new Dictionary <string, string>(); dragAndDropOptions["dropTargets"] = DragAndDrop.DropTargets; objectWriter.AppendObject("dragAndDrop", dragAndDropOptions); } else { objectWriter.Append("dragAndDrop", true); } } if (Ajax.Enabled) { Dictionary <string, string> ajax = new Dictionary <string, string>(); ajax["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, Ajax.Select); objectWriter.AppendObject("ajax", ajax); } if (WebService.Enabled) { Dictionary <string, string> webService = new Dictionary <string, string>(); webService["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, WebService.Select.Url); objectWriter.AppendObject("ws", webService); } objectWriter.AppendClientEvent("onExpand", ClientEvents.OnExpand); objectWriter.AppendClientEvent("onCollapse", ClientEvents.OnCollapse); objectWriter.AppendClientEvent("onSelect", ClientEvents.OnSelect); objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad); objectWriter.AppendClientEvent("onError", ClientEvents.OnError); objectWriter.AppendClientEvent("onChecked", ClientEvents.OnChecked); objectWriter.AppendClientEvent("onNodeDragStart", ClientEvents.OnNodeDragStart); objectWriter.AppendClientEvent("onNodeDragging", ClientEvents.OnNodeDragging); objectWriter.AppendClientEvent("onNodeDragCancelled", ClientEvents.OnNodeDragCancelled); objectWriter.AppendClientEvent("onNodeDrop", ClientEvents.OnNodeDrop); objectWriter.AppendClientEvent("onNodeDropped", ClientEvents.OnNodeDropped); objectWriter.AppendClientEvent("onDataBinding", ClientEvents.OnDataBinding); objectWriter.AppendClientEvent("onDataBound", ClientEvents.OnDataBound); objectWriter.Complete(); base.WriteInitializationScript(writer); }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { var urlBuilder = grid.UrlBuilder; var urls = new Dictionary<string, string>(); if (Select.HasValue() || (SerializeEmptySelectUrl && !Select.HasValue())) { urls["selectUrl"] = Encode(urlBuilder.Url(Select)); } if (Insert.HasValue()) { urls["insertUrl"] = Encode(urlBuilder.Url(Insert)); } if (Update.HasValue()) { urls["updateUrl"] = Encode(urlBuilder.Url(Update)); } if (Delete.HasValue()) { urls["deleteUrl"] = Encode(urlBuilder.Url(Delete)); } writer.AppendObject(key, urls); } }
public void Serialize(IClientSideObjectWriter writer) { var columns = new List <IDictionary <string, object> >(); grid.VisibleColumns.Each(column => { columns.Add(column.CreateSerializer().Serialize()); }); if (columns.Any()) { writer.AppendCollection("columns", columns); } new GridPluginSerializer(grid).SerializeTo(writer); new GridUrlFormatSerializer <T>(grid).SerializeTo(writer); grid.Editing.SerializeTo("editing", writer); var shouldSerializeDataSource = false; #if MVC2 || MVC3 if (grid.OutputValidation) { writer.AppendObject("validationMetadata", grid.ValidationMetadata); } shouldSerializeDataSource = grid.Editing.Enabled && grid.IsClientBinding && !grid.IsEmpty; #endif grid.Grouping.SerializeTo("grouping", writer); grid.Paging.SerializeTo("paging", writer); grid.Sorting.SerializeTo("sorting", writer); grid.Selection.SerializeTo("selection", writer); if (grid.DataBinding.IsClientOperationMode) { writer.Append("operationMode", "client"); shouldSerializeDataSource = true; } grid.KeyboardNavigation.SerializeTo("keyboardNavigation", writer); grid.ColumnContextMenu.SerializeTo("columnContextMenu", writer); if (shouldSerializeDataSource) { grid.SerializeDataSource(writer); } grid.Ajax.SerializeTo("ajax", writer); grid.WebService.SerializeTo("ws", writer); grid.ClientEvents.SerializeTo("clientEvents", writer); grid.Localization.SerializeTo("localization", writer); if (grid.DetailView != null) { grid.DetailView.SerializeTo("detail", writer); } if (grid.ClientRowTemplate.HasValue()) { writer.Append("rowTemplate", grid.IsSelfInitialized ? grid.ClientRowTemplate.Replace("<", "%3c").Replace(">", "%3e") : grid.ClientRowTemplate); } writer.Append("noRecordsTemplate", grid.NoRecordsTemplate); }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Enabled) { Func<string,string> encoder = (string url) => grid.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var urlBuilder = new GridUrlBuilder(grid); var urls = new Dictionary<string, string>(); urls["selectUrl"] = encoder(urlBuilder.Url(Select)); if (Insert.HasValue()) { urls["insertUrl"] = encoder(urlBuilder.Url(Insert)); } if (Update.HasValue()) { urls["updateUrl"] = encoder(urlBuilder.Url(Update)); } if (Delete.HasValue()) { urls["deleteUrl"] = encoder(urlBuilder.Url(Delete)); } writer.AppendObject(key, urls); } }
/// <summary> /// Serializes the asynchronous uploading settings to the writer. /// </summary> /// <param name="writer">The writer object.</param> public void SerializeTo(string key, IClientSideObjectWriter writer) { if (Save.HasValue()) { Func<string, string> encoder = (string url) => upload.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var config = new Dictionary<string, object>(); config["saveUrl"] = encoder(Save.GenerateUrl(upload.ViewContext, upload.UrlGenerator)); if (SaveField.HasValue()) { config["saveField"] = SaveField; } if (Remove.HasValue()) { config["removeUrl"] = encoder(Remove.GenerateUrl(upload.ViewContext, upload.UrlGenerator)); } config["autoUpload"] = AutoUpload; writer.AppendObject(key, config); } }
public void SerializeTo(string key, IClientSideObjectWriter writer) { if (!IsDefault) { writer.AppendObject(key, ToJson()); } }