I have a radgrid that I am trying to setup a filter template for it.
The column is a checkbox column. It is a bit field in the database.
The end users want it to just be a dropdown box with All, Yes, No. I have tried a few things with no luck.
I have another column that displays a "Labor Estimate" for an int data type.
The end users would like to have a drop down list with All, Less than 10, 10 to 40, and more than 40. Is this possible to do also?
The column is a checkbox column. It is a bit field in the database.
<
telerik:GridCheckBoxColumn
DataField
=
"Requirement_Received"
DataType
=
"System.Boolean"
HeaderText
=
"Requirement Received?"
SortExpression
=
"Requirement_Received"
UniqueName
=
"Requirement_Received"
>
<
HeaderStyle
Width
=
"125px"
/>
</
telerik:GridCheckBoxColumn
>
The end users want it to just be a dropdown box with All, Yes, No. I have tried a few things with no luck.
I have another column that displays a "Labor Estimate" for an int data type.
The end users would like to have a drop down list with All, Less than 10, 10 to 40, and more than 40. Is this possible to do also?
4 Answers, 1 is accepted
0

Ryan
Top achievements
Rank 1
answered on 29 Dec 2011, 04:10 PM
I got the check box column to work by doing this. I still need help with the range drop down box.
<
telerik:GridCheckBoxColumn
DataField
=
"Requirement_Received"
DataType
=
"System.Boolean"
HeaderText
=
"Requirement Received?"
SortExpression
=
"Requirement_Received"
UniqueName
=
"Requirement_Received"
>
<
HeaderStyle
Width
=
"75px"
/>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxRequirement_Received"
Width
=
"50"
AppendDataBoundItems
=
"true"
SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Requirement_Received").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="Requirement_ReceivedIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
<
telerik:RadComboBoxItem
Text
=
"Yes"
Value
=
"True"
/>
<
telerik:RadComboBoxItem
Text
=
"No"
Value
=
"False"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock4"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function Requirement_ReceivedIndexChanged(sender, args) {
var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
tableView.filter("Requirement_Received", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridCheckBoxColumn
>
0

Ryan
Top achievements
Rank 1
answered on 29 Dec 2011, 04:49 PM
I figured out the labor range drop down filter.
<
telerik:GridBoundColumn
DataField
=
"Project_Labor_Estimate"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter Project_Labor_Estimate column"
HeaderText
=
"Labor Estimate"
SortExpression
=
"Project_Labor_Estimate"
UniqueName
=
"Project_Labor_Estimate"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxProject_Labor_Estimate"
Width
=
"100"
AppendDataBoundItems
=
"true"
SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Project_Labor_Estimate").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="Project_Labor_EstimateIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
<
telerik:RadComboBoxItem
Text
=
"Less than 10"
Value
=
"0 9"
/>
<
telerik:RadComboBoxItem
Text
=
"10 to 40"
Value
=
"10 40"
/>
<
telerik:RadComboBoxItem
Text
=
"More than 40"
Value
=
"41 999999"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock5"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function Project_Labor_EstimateIndexChanged(sender, args) {
var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
tableView.filter("Project_Labor_Estimate", args.get_item().get_value(), "Between");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
0

Ryan
Top achievements
Rank 1
answered on 29 Dec 2011, 04:51 PM
I have this column.
They just want a drop down list with All, Yes, No.
How would I create the filter to only pull back those that have data/no data or all?
<
telerik:GridDateTimeColumn
FilterControlWidth
=
"120px"
DataField
=
"IS_Delivery_Commitment"
HeaderText
=
"IS Delivery Commitment"
SortExpression
=
"IS_Delivery_Commitment"
UniqueName
=
"IS_Delivery_Commitment"
PickerType
=
"DatePicker"
DataFormatString
=
"{0:MM/dd/yyyy}"
>
</
telerik:GridDateTimeColumn
>
They just want a drop down list with All, Yes, No.
How would I create the filter to only pull back those that have data/no data or all?
0
Hi Ryan,
Customization of the column could be achieved by the FilterTemplate. Additionally, you could go through the help articles below for more in depth and advanced techniques for handling filtering.
Greetings,
Antonio Stoilkov
the Telerik team
Customization of the column could be achieved by the FilterTemplate. Additionally, you could go through the help articles below for more in depth and advanced techniques for handling filtering.
- http://www.telerik.com/help/aspnet-ajax/grid-filtertemplate.html
- http://www.telerik.com/help/aspnet-ajax/grid-filtering-with-dropdownlist.html
Greetings,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now