Hey Guys,
I have a radGrid bound to an object data source declaratively. That source looks at a search box and a category dropdown for search parameters. The search button calls a rebind. Everything works great.
Until I turn grouping on. The grouping works great on first page load, but on subsequent search button postbacks and therefore rebind() calls, there are no records found, even though that search works ok with grouping off.
Anyone know why this might be ? Find my page below:
Thanks for any help.
I have a radGrid bound to an object data source declaratively. That source looks at a search box and a category dropdown for search parameters. The search button calls a rebind. Everything works great.
Until I turn grouping on. The grouping works great on first page load, but on subsequent search button postbacks and therefore rebind() calls, there are no records found, even though that search works ok with grouping off.
Anyone know why this might be ? Find my page below:
<
fieldset
>
<
legend
>Search Help Centre</
legend
>
<
ul
>
<
li
>
<
label
for
=
"tbSearchText"
>Search text</
label
>
<
asp:TextBox
ID
=
"tbSearchText"
runat
=
"server"
/>
</
li
>
<
li
>
<
label
for
=
"catSelector"
>Category</
label
>
<
ah:CategorySelector
ID
=
"catSelector"
runat
=
"server"
CategoryParentCat
=
"Faq"
InsertEmpty
=
"All"
/>
</
li
>
<
li
> :</
li
>
<
li
><
label
for
=
"btnSearch"
> </
label
><
telerik:RadButton
ID
=
"btnSearch"
runat
=
"server"
Text
=
"Search"
OnClick
=
"btnSearch_Click"
/></
li
>
</
ul
>
</
fieldset
>
<
telerik:RadGrid
ID
=
"rgFaq"
runat
=
"server"
DataSourceID
=
"objFaq"
GroupingEnabled
=
"true"
OnItemDataBound
=
"rgFaq_ItemDataBound"
AllowPaging
=
"True"
PageSize
=
"200"
AllowSorting
=
"False"
AutoGenerateColumns
=
"False"
>
<
MasterTableView
DataKeyNames
=
"kbId"
ShowHeader
=
"false"
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"CategoryId"
/>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<%#Eval("kbTitle") %>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:ObjectDataSource
ID
=
"objFaq"
EnablePaging
=
"true"
SelectMethod
=
"SearchFaqList"
SelectCountMethod
=
"SearchFaqList_Count"
runat
=
"server"
TypeName
=
"ArtsHub.BLL.Faq.Faq"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"tbSearchText"
DefaultValue
=
""
Name
=
"searchText"
Type
=
"String"
ConvertEmptyStringToNull
=
"false"
/>
<
asp:ControlParameter
ControlID
=
"catSelector"
PropertyName
=
"SelectedCategoryId"
Name
=
"CategoryId"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
protected
void
btnSearch_Click(
object
sender, EventArgs e)
{
rgFaq.DataBind();
}
protected
void
rgFaq_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridGroupHeaderItem)
{
GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
item.DataCell.Text = groupDataRow[
"CategoryId"
].ToString();
}
}
Thanks for any help.