4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 23 Oct 2013, 07:05 AM
Hi Mark,
One suggestion is to add a Literal Control next to the export button as shown below.
C#:
Thanks,
Princy.
One suggestion is to add a Literal Control next to the export button as shown below.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridCommandItem)
{
GridCommandItem cmd = (GridCommandItem)e.Item;
Button btn = (Button)cmd.FindControl(
"ExportToExcelButton"
);
LiteralControl lbl =
new
LiteralControl();
lbl.Text =
"ExportToExcel"
;
lbl.ID =
"lblExport"
;
btn.Parent.Controls.AddAt(4,lbl);
}
}
Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 23 Oct 2013, 02:00 PM
Hi Princy,
The code worked perfectly! Thanks!
Is there a way to make the lbl an extension of the Excel Button, so you can click on it as well to export?
I could certainly switch lbl to a link button and make my own click event handler for the export.
Thanks,
Mark
The code worked perfectly! Thanks!
Is there a way to make the lbl an extension of the Excel Button, so you can click on it as well to export?
I could certainly switch lbl to a link button and make my own click event handler for the export.
Thanks,
Mark
0
Princy
Top achievements
Rank 2
answered on 24 Oct 2013, 06:56 AM
Hi Mark,
To obtain the Export on click of the text,you have to use LinkButton and instead of using the event handler you can set CommandName. Please move the code to ItemCreated event.Try the following code snippet.
C#:
Thanks,
Princy
To obtain the Export on click of the text,you have to use LinkButton and instead of using the event handler you can set CommandName. Please move the code to ItemCreated event.Try the following code snippet.
C#:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridCommandItem)
{
GridCommandItem cmd = (GridCommandItem)e.Item;
Button btn = (Button)cmd.FindControl(
"ExportToExcelButton"
);
LinkButton lnk =
new
LinkButton();
lnk.Text =
"ExportToExcel"
;
lnk.ID =
"lnkExport"
;
lnk.CommandName =
"ExportToExcel"
;
btn.Parent.Controls.AddAt(4, lnk);
}
}
Thanks,
Princy
0
Mark
Top achievements
Rank 1
answered on 24 Oct 2013, 08:13 PM
Worked great! Thanks a bunch! :-)