public void ApplyProperty(HtmlObject target, ControlProperty property, object value, ControlPropertyApplyResult result)
        {
            Object getParams = null;
            var    urlStr    = value.AsString();
            var    uri       = new Uri(urlStr, UriKind.RelativeOrAbsolute);

            //url.
            if (GetParamsProperty != null)
            {
                getParams = target.GetValue(GetParamsProperty);
            }
            if (getParams != null)
            {
                IDictionary <String, Object> dict = null;
                if (!(getParams is IDictionary <String, Object>))
                {
                    dict = ReflectionHelper.AnonymousToDictionary(getParams);
                }
                else
                {
                    dict = (IDictionary <String, Object>)getParams;
                }
                if (uri.Query.HasValue())
                {
                    urlStr += urlStr + "&" + Utils.EncodeGetParams(dict);
                }
                else
                {
                    urlStr += uri.ToString() + "?" + Utils.EncodeGetParams(dict);
                }
            }
            if (urlStr != null)
            {
                result.Attributes[HtmlAttr.Href] = urlStr;
            }
        }
Example #2
0
 public static T SetGetParams <T>(this T control, Object getParams) where T : Link
 {
     control.GetParams = ReflectionHelper.AnonymousToDictionary(getParams);
     return(control);
 }
Example #3
0
 public static string EncodeGetParams(Object paramList)
 {
     return(EncodeGetParams(ReflectionHelper.AnonymousToDictionary(paramList)));
 }