Exemple #1
0
 public RadioItemProxy()
 {
     _radioItem = new RadioItem()
     {
         Proxy = this
     };
 }
        /// <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));
            }
        }