I have a RadGrid with Pager Template. The pager contains 4 asp buttons for next, previous, last and first functions also we have RadComboBox to set the pagesize, a RadNumeric TextBox for Current page index. The Pager template is defined in aspx page. My problem is i can't get this controls in server side ( in C# ). How can i get this pager template controls in RadGrid from Server Side(C#).
also how can i handle the events of this pager template controls from server side.
also how can i handle the events of this pager template controls from server side.
3 Answers, 1 is accepted
0
Hello Velkumar,
You can wire ItemCreated event of RadGrid, check if e.Item is GridPagerItem and find the needed controls in pager template.
For more information about how to achieve the desired functionality, you can refer to the online resources below:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/pagertemplate/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdsettingpagertemplate.html
Kind regards,
Pavlina
the Telerik team
You can wire ItemCreated event of RadGrid, check if e.Item is GridPagerItem and find the needed controls in pager template.
For more information about how to achieve the desired functionality, you can refer to the online resources below:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/pagertemplate/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdsettingpagertemplate.html
Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Velkumar
Top achievements
Rank 2
answered on 09 Apr 2011, 06:19 AM
Hello Pavlina ,
I am using the following code in RadGrid to Create pager Template.
In this i have buttons, checkbox, and combobox. Can i create object for this items (for asp button ---> Button Button1, for RadNumerictextBox RadNumericTextbox1....etc). also i have a problem that is unable to receive or handle the events such as click for button , textchanged for RadNumerictextBox from server side(C#).
Button1 is present inside Pagertemplate. While clicking this function will not call. this problem will also arise for RadNumericTextBox,
RadComboBox, . please give the solution for this problems.
Thanks,
Velkumar.
I am using the following code in RadGrid to Create pager Template.
<
telerik:RadGrid
runat
=
"server"
AllowMultiRowSelection
=
"false"
ID
=
"radGridTaxRate"
Font-Names
=
"Verdana"
Skin
=
"Marzar"
EnableEmbeddedSkins
=
"false"
AutoGenerateColumns
=
"False"
>
<
ClientSettings
EnablePostBackOnRowClick
=
"false"
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
AllowPaging
=
"true"
>
<
PagerTemplate
>
<
asp:Panel
ID
=
"PagerPanel"
Style
=
"padding: 6px"
runat
=
"server"
>
<
div
style
=
"float: left"
>
<
span
style
=
"margin-top: 2px; float: left; margin-right: 3px;font-size:8pt;"
>Page size:</
span
>
<
telerik:RadComboBox
Skin
=
"Office2007"
ID
=
"RadComboBox1"
DataSource="<%# new object[]{10, 20, 30, 40, 50} %>"
Style="margin-top: 2px;float: left; vertical-align: baseline; margin-right: 20px; text-align:center; height:25px"
Width="40px" SelectedValue='<%# DataBinder.Eval(Container, "Paging.PageSize") %>'
runat="server" OnClientSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" CssClass="CustomCssClass" >
</
telerik:RadComboBox
>
</
div
>
<
div
style
=
"margin: 0px; float: right;"
></
div
>
<
div
style
=
"margin: 0px; padding: 0px; float: left; margin-right: 10px; white-space: nowrap;"
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
OnClientClick
=
"changePage('first'); return false;"
CommandName
=
"Page"
CommandArgument
=
"First"
CssClass
=
"PagerButton FirstPage"
/>
<
asp:Button
ID
=
"Button2"
runat
=
"server"
OnClientClick
=
"changePage('prev'); return false;"
CommandName
=
"Page"
CommandArgument
=
"Prev"
CssClass
=
"PagerButton PrevPage"
/>
<
span
style
=
"vertical-align: middle;font-size:8pt;"
>Page:</
span
>
<
telerik:RadNumericTextBox
ID
=
"RadNumericTextBox1"
Skin
=
"Office2007"
Width
=
"25px"
Font-Size
=
"8pt"
Value='<%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>'
runat="server" EnabledStyle-HorizontalAlign="Center" >
<
ClientEvents
OnValueChanged
=
"RadNumericTextBox1_ValueChanged"
/>
<
NumberFormat
DecimalDigits
=
"0"
/>
</
telerik:RadNumericTextBox
>
<
span
style
=
"vertical-align: middle;font-size:8pt;"
>of
<%# DataBinder.Eval(Container, "Paging.PageCount")%>
</
span
>
<
asp:Button
ID
=
"Button3"
runat
=
"server"
OnClientClick
=
"changePage('next'); return false;"
CommandName
=
"Page"
CommandArgument
=
"Next"
CssClass
=
"PagerButton NextPage"
/>
<
asp:Button
ID
=
"Button4"
runat
=
"server"
OnClientClick
=
"changePage('last'); return false;"
CommandName
=
"Page"
CommandArgument
=
"Last"
CssClass
=
"PagerButton LastPage"
/>
</
div
>
<
asp:Panel
runat
=
"server"
ID
=
"NumericPagerPlaceHolder"
/>
</
asp:Panel
>
</
PagerTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
In this i have buttons, checkbox, and combobox. Can i create object for this items (for asp button ---> Button Button1, for RadNumerictextBox RadNumericTextbox1....etc). also i have a problem that is unable to receive or handle the events such as click for button , textchanged for RadNumerictextBox from server side(C#).
protected Button Button1;
----------------------------------
Button1.Click += new EventHandler(Button1_Click);
-----------------------------------------------------
void Button1_Click(object sender, EventArgs e)
{
}
Button1 is present inside Pagertemplate. While clicking this function will not call. this problem will also arise for RadNumericTextBox,
RadComboBox, . please give the solution for this problems.
Thanks,
Velkumar.
0

Princy
Top achievements
Rank 2
answered on 11 Apr 2011, 08:16 AM
Hello,
Give a try this code. Hope this might help you.
C#:
With regards,
Princy.
Give a try this code. Hope this might help you.
C#:
protected
void
radGridTaxRate_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
GridPagerItem pagerItem = (GridPagerItem)e.Item;
Button btn1 = (Button)pagerItem.FindControl(
"Button1"
);
btn1.Click +=
new
EventHandler(btn1_Click);
}
}
void
btn1_Click(
object
sender, EventArgs e)
{
}
With regards,
Princy.