3 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 07 Nov 2013, 05:55 AM
Hi Carlos,
Please try the following code snippet to obtain data after Filter for autogenerated columns.
C#:
Thanks,
Princy
Please try the following code snippet to obtain data after Filter for autogenerated columns.
C#:
static
bool
IsFilter =
false
;
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(IsFilter ==
true
)
//Access after the filter
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
// Get the datas after filtering
string
name1= item[
"DataFieldName1"
].Text;
string
name2= item[
"DataFieldName2"
].Text;
}
}
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.FilterCommandName)
{
IsFilter =
true
;
}
}
Thanks,
Princy
0
Carlos
Top achievements
Rank 1
answered on 11 Nov 2013, 10:44 AM
Hi doesnt that code only give the ones that a e one page in radgrid, when paging in on.
Ihave to remember that my column are auto generated and i dont know the name of the columns.
Ihave to remember that my column are auto generated and i dont know the name of the columns.
0
Princy
Top achievements
Rank 2
answered on 11 Nov 2013, 11:29 AM
Hi Carlos,
Please try the following code snippet to access the filtered data when Paging is allowed.
C#:
Thanks,
Princy
Please try the following code snippet to access the filtered data when Paging is allowed.
C#:
static
bool
IsFilter =
false
;
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.FilterCommandName)
{
IsFilter =
true
;
}
}
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(IsFilter )
{
int
count = RadGrid1.MasterTableView.Items.Count;
RadGrid1.AllowPaging =
false
;
RadGrid1.Rebind();
foreach
(GridColumn col
in
RadGrid1.MasterTableView.AutoGeneratedColumns)
{
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
string
name1= item[col.UniqueName].Text;
}
}
RadGrid1.AllowPaging =
true
;
RadGrid1.Rebind();
}
}
Thanks,
Princy