I'm having a few problems getting the custom filtering to work. At the moment, I'm getting an error because the SQL Select command string ends up looking like this:
The inline code was borrowed from the demo and modified for my needs. Apart from the problem above, it's picking up the ID field in the example above rather than the 'group_name' field. The inline code is this:
Oh ... and here's the codebehind:
The error crops up on the Rebind.
Where is the problem being caused?
Thanks.
SELECT
*
FROM
WTO_LinkGroups
WHERE
(
Convert
.ToString(it[
"group_name"
]) =
"3"
)
The inline code was borrowed from the demo and modified for my needs. Apart from the problem above, it's picking up the ID field in the example above rather than the 'group_name' field. The inline code is this:
<
telerik:GridBoundColumn
DataField
=
"group_name"
HeaderText
=
"Group Name"
SortExpression
=
"group_name"
UniqueName
=
"group_name"
>
<
FilterTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"GroupNameComboBox"
DataSourceID
=
"SqlDataSource1"
DataTextField
=
"group_name"
DataValueField
=
"group_id"
Height
=
"200px"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("group_name").CurrentFilterValue %>'
OnClientSelectedIndexChanged="GroupNameIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function GroupNameIndexChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("group_name", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
Oh ... and here's the codebehind:
protected
void
RefreshCombos()
{
SqlDataSource1.SelectCommand =
"SELECT * FROM WTO_LinkGroups WHERE "
+ RadGrid1.MasterTableView.FilterExpression.ToString();
SqlDataSource1.SelectCommandType = System.Web.UI.WebControls.SqlDataSourceCommandType.Text;
RadGrid1.MasterTableView.Rebind();
}
The error crops up on the Rebind.
Where is the problem being caused?
Thanks.