/// <summary> /// Returns javascript code needed by the validation framework. /// </summary> /// <param name="codeType"></param> /// <returns></returns> internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return("keypress"); case ClientCodeType.PreLoadData: return(string.Empty); case ClientCodeType.LoadData: return("function(data) { $(this).textBoxEx('setval', data); }"); case ClientCodeType.GetValue: return("function() { return $(this).textBoxEx('getval'); }"); case ClientCodeType.InputSelector: return(this.ClientSelector); case ClientCodeType.MinLengthErrorMessage: return(string.Format("{0} must contain at least {{0}} characters", this.FriendlyName)); default: return(base.GetClientCode(codeType)); } }
/// <summary> /// Returns javascript code needed by the validation framework. /// </summary> /// <param name="codeType"></param> /// <returns></returns> internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return(this.ClientChangeEventName); case ClientCodeType.MinLengthErrorMessage: return(string.Format("Please select at least {0} {{0}}", this.FriendlyName)); case ClientCodeType.MaxLengthErrorMessage: return(string.Format("Please select no more than {{0}} {0}", this.FriendlyName)); case ClientCodeType.GetValue: // toString converts array into comma seperated list return("function() { return $(this).checkBoxListEx('values'); }"); // Only the first check box needs to be valdiated case ClientCodeType.InputSelector: return(string.Format("{0} input:checkbox:first", this.ClientSelector)); //case ClientCodeType.LoadData: // return "function(data) { $(this).checkBoxListEx('load', data); }"; default: return(base.GetClientCode(codeType)); } }
/// <summary> /// Minimum implementation to support <c>Cascadable</c> /// </summary> /// <param name="codeType"></param> /// <returns></returns> internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return("keypress"); case ClientCodeType.PreLoadData: break; case ClientCodeType.LoadData: return(string.Empty); case ClientCodeType.GetValue: return("function() { return $(this).autocompleteEx('selectedValue'); }"); case ClientCodeType.SetValue: break; case ClientCodeType.MinLengthErrorMessage: break; case ClientCodeType.MaxLengthErrorMessage: break; case ClientCodeType.InputSelector: break; default: break; } return(base.GetClientCode(codeType)); }
/// <summary> /// Returns javascript code needed by the validation framework. /// </summary> /// <param name="codeType"></param> /// <returns></returns> internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.SetValue: return("function(val) { $(this).radioButtonListEx('setValue', val); }"); case ClientCodeType.GetValue: return("function() { return $(this).radioButtonListEx('val'); }"); case ClientCodeType.InterestEvent: return("change"); case ClientCodeType.InputSelector: RadioItem item = this.Items.FirstOrDefault(p => p.Proxy == null); if (item == null) { // Selector of the proxy return(this.Items.Where(p => p.Proxy != null) .Select(p => string.Format("#{0}", p.Proxy.ClientID)) .First()); } else { // First radio within us return(string.Format("{0} input:radio:first", this.ClientSelector)); } default: return(base.GetClientCode(codeType)); } }
internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return("click"); case ClientCodeType.InputSelector: return(this.ClientSelector); case ClientCodeType.GetValue: return("function(e) { return $(this).val(); }"); //case ClientCodeType.LoadData: // return "function(data) { $(this).dropDownListEx('fill', data); }"; //case ClientCodeType.PreLoadData: // return "function(data) { $(this).dropDownListEx('preFill'); }"; // case ClientCodeType.SetCookie: // if (string.IsNullOrEmpty(this.Cascadable.WebMethod)) // { // // Base class will do fine // return base.GetClientCode(codeType); // } // // Store both text and value in cookie // string func = string.Format(@"function(e) {{ //$(this).{0}('setCookie'); //}}", this.WidgetName); // return func; default: return(base.GetClientCode(codeType)); } }
internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return("click"); case ClientCodeType.InputSelector: return(this.ClientSelector); case ClientCodeType.GetValue: return("function(e) { return $(this).val(); }"); case ClientCodeType.LoadData: return("function(data) { $(this).dropDownListEx('fill', data); }"); case ClientCodeType.PreLoadData: return("function(data) { $(this).dropDownListEx('preFill'); }"); case ClientCodeType.SetCookie: // Store both text and value in cookie string func = string.Format(@"function(e) {{ $(this).{0}('setCookie'); }}", this.WidgetName); return(func); default: return(base.GetClientCode(codeType)); } }
internal override string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.InterestEvent: return("click"); case ClientCodeType.GetValue: return("function(e) { return $(this).is(':checked') ? $(this).val() : ''; }"); case ClientCodeType.InputSelector: return(this.ClientSelector); case ClientCodeType.SetValue: return(@"function(val) { val ? $(this).attr('checked', 'checked') : $(this).removeAttr('checked') ; }"); default: return(base.GetClientCode(codeType)); } }
internal virtual string GetClientCode(ClientCodeType codeType) { switch (codeType) { case ClientCodeType.PreLoadData: return(string.Empty); case ClientCodeType.MaxLengthErrorMessage: return(string.Format("{0} must be at most {{0}} characters", this.FriendlyName)); case ClientCodeType.InputSelector: return(this.ClientSelector); case ClientCodeType.SetCookie: string func = string.Format(@"function(e) {{ var newval = ({1}).call(this); createCookie('{0}', newval, {2}); }}", this.QueryString, this.GetClientCode(ClientCodeType.GetValue), this.CookieExpiryDays); return(func); default: throw new NotSupportedException(this.GetType().ToString() + " does not support " + codeType.ToString()); } }