Beispiel #1
0
 /// <summary>
 /// Submits specified form via ajax to the url specified, and updates the supplied updatePanel with the value
 /// returned from the server. It validates the inputs within the specified container.
 /// </summary>
 public JSBuilder SubmitFormViaAjax_ValidateContainer(string formId, string postUrl, string updatePanel, string containerId, JSObject ajaxFormSubmitOptions = null)
 {
     var script = new JSBuilder();
     script.AddLine("bf.submitForm('{0}',{1})", formId, JSObject.Create()
                                                                 .Add("viaAjax", true)
                                                                 .Add("validate", true)
                                                                 .AddString("validatePartialFormId", containerId)
                                                                 .AddString("ajaxPostUrl", postUrl)
                                                                 .AddString("updatePanel", updatePanel)
                                                                 .Add("ajaxOptions", ajaxFormSubmitOptions)
                                                                 .ToString());
     return script;
 }
Beispiel #2
0
 /// <summary>
 /// Performs an ajax request and loads the content of the supplied url into the elementid specified.
 /// You can also optionally toggle the contents, this means that if the content is showing the
 /// ajax call is not performed and the elementid's content is cleared and hidden. When the element
 /// is hidden then the ajax request happens and the the fills the element and shows it
 /// </summary>
 /// <param name="url">Url to request from</param>
 /// <param name="elementid">The element that will hold the response</param>
 /// <param name="toggle">When true retreives the content and fills the element only when it is not showing</param>
 public JSBuilder Load(string url, string elementid, bool toggle)
 {
     var js = new JSBuilder();
     js.AddLine("bf.loadUrl('{0}','{1}', {2})", JSBuilder.CleanString(url), 
                                                 JSBuilder.CleanString(elementid), 
                                                 toggle.ToString().ToLowerInvariant());
     return js;
 }
Beispiel #3
0
 /// <summary>
 /// Submits the parent form of this element via ajax to the url specified, and updates the supplied updatePanel with the value
 /// returned from the server. Optionally does validation
 /// </summary>
 public JSBuilder SubmitParentFormViaAjax(string postUrl, string updatePanel, bool validate = true, JSObject ajaxFormSubmitOptions = null)
 {
     var script = new JSBuilder();
     script.AddLine("bf.submitParentForm(this,{0})", JSObject.Create()
                                                             .Add("viaAjax", true)
                                                             .Add("validate", validate)
                                                             .AddString("ajaxPostUrl", postUrl)
                                                             .AddString("updatePanel", JQHelper.GetElementID(updatePanel))
                                                             .Add("ajaxOptions", ajaxFormSubmitOptions)
                                                             .ToString());
     return script;
 }