Hi,
In this case I am binding the grid programmatically in the page load, then when a user does a search, I am binding the grid with a different dataset, when I enable paging after the search it binds back the original dataset; here is the code:
And here is the HTML:
I am not sure if there should be a code to be inserted in the index paging?
Please let me know.
Thank you in advance,
Shehab
In this case I am binding the grid programmatically in the page load, then when a user does a search, I am binding the grid with a different dataset, when I enable paging after the search it binds back the original dataset; here is the code:
public
partial
class
PageSearch : System.Web.UI.Page
{
public
ACHPagingDLL.dl dl =
new
ACHPagingDLL.dl();
protected
void
Page_Load(
object
sender, EventArgs e)
{
LoadGrid();
}
public
void
LoadGrid()
{
DataSet dsPatients = dl.c_FN_Paging_getAllEmployees();
rgEmployees.DataSource = dsPatients;
rgEmployees.DataBind();
}
protected
void
btnSearch_Click(
object
sender, EventArgs e)
{
if
(txtSearch.Text.Length < 2)
{
litResult.Visible =
true
;
litResult.Text =
"<FONT color=#cc0000 size=3>Search for 2 or more characters!</FONT>"
;
LoadGrid();
return
;
}
else
{
DataSet dsSearch = dl.c_FN_seachEmployees(txtSearch.Text);
rgEmployees.DataSource = dsSearch;
rgEmployees.DataBind();
}
}
}
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
>
<
table
class
=
"style4"
>
<
tr
>
<
td
class
=
"style5"
>
Search for employee by name:</
td
>
<
td
class
=
"style6"
>
<
telerik:RadTextBox
ID
=
"txtSearch"
Runat
=
"server"
Width
=
"160px"
>
</
telerik:RadTextBox
>
<
telerik:RadButton
ID
=
"btnSearch"
runat
=
"server"
onclick
=
"btnSearch_Click"
Text
=
"Search"
>
</
telerik:RadButton
>
</
td
>
<
td
>
<
asp:Literal
ID
=
"litResult"
runat
=
"server"
></
asp:Literal
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
>
<
telerik:RadGrid
ID
=
"rgEmployees"
runat
=
"server"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
Skin
=
"WebBlue"
>
<
MasterTableView
pagesize
=
"20"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
>
</
CommandItemSettings
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"EmployeeNo"
UniqueName
=
"EmployeeNo"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EmployeeName"
HeaderText
=
"Employee"
UniqueName
=
"EmployeeName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Pager"
HeaderText
=
"Pager"
UniqueName
=
"Pager"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Office"
HeaderText
=
"Office#"
UniqueName
=
"Office"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Cell"
HeaderText
=
"Cell Phone"
UniqueName
=
"Cell"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Email"
HeaderText
=
"Email"
UniqueName
=
"Email"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
HeaderContextMenu
EnableImageSprites
=
"True"
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
>
</
td
>
</
tr
>
</
table
>
</
telerik:RadAjaxPanel
>
I am not sure if there should be a code to be inserted in the index paging?
Please let me know.
Thank you in advance,
Shehab