<telerik:GridBoundColumn UniqueName="Total" DataField="Total" FooterStyle-Font-Bold="true" FooterStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="95px" DataFormatString="{0:N} TL" HeaderText="Tutar" Aggregate="Sum" AutoPostBackOnFilter="false" ShowFilterIcon="true"> <FilterTemplate> <asp:TextBox CssClass="rgFilterBox" Width="20" ID="ToValue" runat="server" Text='<%# endValue %>'></asp:TextBox> <asp:TextBox CssClass="rgFilterBox" Width="20" ID="FromValue" runat="server" Text='<%# startValue %>'></asp:TextBox> <input type="button" class="rgFilter" title="Filtrele" id="btnValueFilter" onclick="DoValueRangeFilter()" value=" " name="btnValueFilter"> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function DoValueRangeFilter() { var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); var fromval = $.trim($("#<%# ((GridItem)Container).FindControl("FromValue").ClientID %>").val()); var toval = $.trim($("#<%# ((GridItem)Container).FindControl("ToValue").ClientID %>").val()); tableView.filter("Total", fromval + " " + toval, "Between"); } </script> </telerik:RadScriptBlock> </FilterTemplate></telerik:GridBoundColumn>
protected void grd_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.FilterCommandName)
{
Pair filterPair = (Pair)e.CommandArgument;
switch (filterPair.Second.ToString())
{
case "OrderDate":
this.startDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("FromDatePicker") as RadDatePicker).SelectedDate;
this.endDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("ToDatePicker") as RadDatePicker).SelectedDate;
break;
case "Total":
this.startValue = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("FromValue") as TextBox).Text;
this.endValue = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("ToValue") as TextBox).Text;
break;
default:
break;
}
}
}
protected string startValue
{
set
{
ViewState["strV"] = value;
}
get
{
if (ViewState["strV"] != null)
return (string)ViewState["strV"];
else
return "";
}
}
protected string endValue
{
set
{
ViewState["endV"] = value;
}
get
{
if (ViewState["endV"] != null)
return (string)ViewState["endV"];
else
return "";
}
}
Hi, I've a boundcolumn named total and i want to filter that column having values range between x to y.
i copied codes from demo in this link and modified for myself to decimal range.
thats my issue :
when i fill range textboxes (ex: ToValue=5 and Fromvalue=1) and press filter button
this.startValue has "1 5" and this.endValue has "5".
i changed the order of textboxes and realized that the first textbox always gets the both boxes value with a space between them.
Am i missing something or is this a bug??