Example #1
0
        public override string FilterRender(HtmlHelper htmlHelper)
        {
            string SelectedValue = htmlHelper.ViewContext.HttpContext.Request.QueryString[Name];

            if (FilterSource != null)
            {
                SelectListItem item = FilterSource.FirstOrDefault(n => n.Value == SelectedValue);
                if (item != null)
                {
                    item.Selected = true;
                }
                return(htmlHelper.DropDownList(base.Name, FilterSource, "Seçiniz", new { @class = "form-control" }).ToString());
            }

            if (GetMemberType() == typeof(int))
            {
                return(htmlHelper.TextBox(Name, SelectedValue, new { type = "number", @class = "form-control" }).ToString());
            }
            else if (GetMemberType() == typeof(string))
            {
                return(htmlHelper.TextBox(Name, SelectedValue, new { @class = "form-control" }).ToString());
            }
            else if (GetMemberType() == typeof(DateTime))
            {
                return(htmlHelper.TextBox(Name, SelectedValue, new { @class = "form-control" }).ToString());
            }
            else if (GetMemberType() == typeof(bool))
            {
                return(htmlHelper.CheckBox(Name, SelectedValue == "1").ToString());
            }
            else
            {
                return("");
            }
        }