hello to all,
Once again i would like to thank, to all member of telerik that response's my question.
Hello to all i would like to ask some help for this particular problem in exporting data from the radgrid with a linkbutton in every row in a grid, i tried to use the codes being posted on the example it works but the problem is one of my column with link on it the data was not carried to excel and that field is empty, is there a way to get that data?
here's my column name and two sample data in my Radgrid;
the Subject column has a linkbutton so when the user click on it, it will redirected to another page with details
now i want all records send to excel but this subject column is empty when i look on the excel. please help
Request ID Subject Description
0000001 Paper Long Bond Paper
0000002 Clip Paper Clip
then i have a button below namely send to excel
sample/codes is highly appreciated
Once again i would like to thank, to all member of telerik that response's my question.
Hello to all i would like to ask some help for this particular problem in exporting data from the radgrid with a linkbutton in every row in a grid, i tried to use the codes being posted on the example it works but the problem is one of my column with link on it the data was not carried to excel and that field is empty, is there a way to get that data?
here's my column name and two sample data in my Radgrid;
the Subject column has a linkbutton so when the user click on it, it will redirected to another page with details
now i want all records send to excel but this subject column is empty when i look on the excel. please help
Request ID Subject Description
0000001 Paper Long Bond Paper
0000002 Clip Paper Clip
then i have a button below namely send to excel
sample/codes is highly appreciated
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 01 Apr 2009, 07:57 AM
Hello Jols,
You can refer to the section 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data' in the following document to find out how you can export a GidTemplate/GridButton column to Excel:
Exporting tips and tricks
Thanks
Princy.
You can refer to the section 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data' in the following document to find out how you can export a GidTemplate/GridButton column to Excel:
Exporting tips and tricks
Thanks
Princy.
0
Jols
Top achievements
Rank 2
answered on 01 Apr 2009, 10:50 AM
thank you so much for the link, one more question i have a checkbox on the grid same grid as above i wrote, when the user check for his desired row and send to excel then those row data selected will be send to excel, how can i do that please help
sample/codes is higly appreciated
once again thanks and more power
sample/codes is higly appreciated
once again thanks and more power
0
Princy
Top achievements
Rank 2
answered on 02 Apr 2009, 04:16 AM
Hello Jols,
You can try out the following code to export only the selected rows in the grid :
c#:
Thanks
Princy.
You can try out the following code to export only the selected rows in the grid :
c#:
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| foreach (GridDataItem item in RadGrid1.Items) |
| { |
| if (item.Selected==false) |
| { |
| item.Visible = false; |
| } |
| } |
| RadGrid1.ExportSettings.ExportOnlyData = true; |
| RadGrid1.ExportSettings.OpenInNewWindow = true; |
| RadGrid1.MasterTableView.ExportToExcel(); |
| } |
Thanks
Princy.
0
Shinu
Top achievements
Rank 2
answered on 02 Apr 2009, 04:44 AM
Hi Jols,
One more thing.. if you are using checkbox column, try the below code to check whether the checkbox is checked and hide the other unchecked rows and export..
-Shinu.
One more thing.. if you are using checkbox column, try the below code to check whether the checkbox is checked and hide the other unchecked rows and export..
| protected void Export_Click(object sender, EventArgs e) |
| { |
| foreach(GridItem item in RadGrid1.MasterTableView.Items) |
| { |
| if(item is GridDataItem) |
| { |
| GridDataItem currentItem = item as GridDataItem; |
| //Find the checkbox and if unchecked make the row visible false |
| CheckBox box = (CheckBox)currentItem["CheckBoxColumn"].Controls[0]; |
| if(!box.Checked) |
| { |
| currentItem.Visible=false; |
| } |
| } |
| } |
| RadGrid1.Rebind(); |
| RadGrid1.MasterTableView.ExportToExcel(); |
| } |
-Shinu.
0
Jols
Top achievements
Rank 2
answered on 02 Apr 2009, 07:30 AM
good day!
Sir Princy i tried to follow the codes on the tips and tricks on how to set visibility equals to false on my linkbutton on my grid but it wont work on the other columns that set to be visible equal to true so i can export the data to excel. here's my codes and source please kindly check if i miss something or i made a mistakes..
my codes;
switch (e.Item.Value)//parentroot
{
case "2"://Excel
RadMenuItem Excel = e.Item;
foreach (GridDataItem item in RdGridMainpage.Items)
{
if (item.Selected == false)
{
this.RdGridMainpage.Columns.FindByUniqueName( "SubjectData").Visible = true ;
this.RdGridMainpage.Columns.FindByUniqueName( "SubjectButton").Visible = false ;
item.Visible = false;
}
}
RdGridMainpage.ExportSettings.ExportOnlyData = true;
RdGridMainpage.ExportSettings.OpenInNewWindow = true;
RdGridMainpage.MasterTableView.ExportToExcel();
break;
}
my source file;
<telerik:GridButtonColumn CommandName="Select" DataTextField="Subject" HeaderText="Subject"
UniqueName="SubjectButton" ItemStyle-HorizontalAlign ="Left" >
<ItemStyle HorizontalAlign="Left" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn Visible ="false" DataField="Subject" HeaderText="Subject" UniqueName="SubjectData" ItemStyle-HorizontalAlign ="Left" >
</telerik:GridBoundColumn>
thanks and more power
waiting for your reply
Sir Princy i tried to follow the codes on the tips and tricks on how to set visibility equals to false on my linkbutton on my grid but it wont work on the other columns that set to be visible equal to true so i can export the data to excel. here's my codes and source please kindly check if i miss something or i made a mistakes..
my codes;
switch (e.Item.Value)//parentroot
{
case "2"://Excel
RadMenuItem Excel = e.Item;
foreach (GridDataItem item in RdGridMainpage.Items)
{
if (item.Selected == false)
{
this.RdGridMainpage.Columns.FindByUniqueName( "SubjectData").Visible = true ;
this.RdGridMainpage.Columns.FindByUniqueName( "SubjectButton").Visible = false ;
item.Visible = false;
}
}
RdGridMainpage.ExportSettings.ExportOnlyData = true;
RdGridMainpage.ExportSettings.OpenInNewWindow = true;
RdGridMainpage.MasterTableView.ExportToExcel();
break;
}
my source file;
<telerik:GridButtonColumn CommandName="Select" DataTextField="Subject" HeaderText="Subject"
UniqueName="SubjectButton" ItemStyle-HorizontalAlign ="Left" >
<ItemStyle HorizontalAlign="Left" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn Visible ="false" DataField="Subject" HeaderText="Subject" UniqueName="SubjectData" ItemStyle-HorizontalAlign ="Left" >
</telerik:GridBoundColumn>
thanks and more power
waiting for your reply