3 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 May 2012, 01:28 PM
Hi,
RadGrid supports in built filtering and paging functionalities.In order to handle any server side events explicitly, you can attach ItemCommand event and PageIndexChanged events respectively. Please check the following help documentations which explains more about this.
Basic Paging
Basic Filtering
Thanks,
Princy.
RadGrid supports in built filtering and paging functionalities.In order to handle any server side events explicitly, you can attach ItemCommand event and PageIndexChanged events respectively. Please check the following help documentations which explains more about this.
Basic Paging
Basic Filtering
Thanks,
Princy.
0
Dorababu
Top achievements
Rank 1
answered on 15 May 2012, 01:42 PM
Thanks but on filter my paging is not visible what to do for that
How can I enable paging on filter
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.FilterCommandName)
{
Pair filterPair = (Pair)e.CommandArgument;
//gridMessage1 = "Current Filter function: '" + filterPair.First + "' for column '" + filterPair.Second + "'";
TextBox filterBox = (e.Item
as
GridFilteringItem)[filterPair.Second.ToString()].Controls[0]
as
TextBox;
SqlConnection conn =
new
SqlConnection(connStr);
dt =
new
DataTable();
com.Connection = conn;
com.CommandText =
"SELECT * FROM tblEmployees where EmployeeID='"
+ filterBox.Text +
"' OR FirstName='"
+ filterBox.Text +
"' OR LastName='"
+ filterBox.Text +
"' OR Address='"
+ filterBox.Text +
"'"
;
sqlda =
new
SqlDataAdapter(com);
sqlda.Fill(dt);
RadGrid1.DataSource = dt;
RadGrid1.DataBind();
//gridMessage2 = "<br> Entered pattern for search: " + filterBox.Text;
}
}
0
Princy
Top achievements
Rank 2
answered on 16 May 2012, 06:53 AM
Hi
I guess you are binding the RadGrid in NeedDataSource and enabled paging. Try setting the PagerStyle property AlwaysVisible to true. I tried the same senario and the paging worked fine when I bind the RadGrid after filtering in the NeedDataSource event checking for FilterExpression.
C#:
Thanks,
Princy.
I guess you are binding the RadGrid in NeedDataSource and enabled paging. Try setting the PagerStyle property AlwaysVisible to true. I tried the same senario and the paging worked fine when I bind the RadGrid after filtering in the NeedDataSource event checking for FilterExpression.
C#:
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if
(RadGrid1.MasterTableView.FilterExpression ==
""
)
{
// bind the grid
}
else
{
// bind the grid after filtering
}
}
public
static
string
filterPattern =
""
;
protected
void
RadGrid1_ItemCommand(
object
sender, Telerik.Web.UI.GridCommandEventArgs e)
{
Pair filterPair = (Pair)e.CommandArgument;
filterPattern = ((TextBox)(e.Item
as
GridFilteringItem)[filterPair.Second.ToString()].Controls[0]).Text;
}
Thanks,
Princy.