hi,
how do i hide column from a grid? i use data to bind to the grid and have autogenerate columns enable. i tried radgrid1.masterviewtable.items(0).visible=false. could you tell me what the correct syntax is? Also when i export data how do i format the columns or cells ? thank you very much for helping.
how do i hide column from a grid? i use data to bind to the grid and have autogenerate columns enable. i tried radgrid1.masterviewtable.items(0).visible=false. could you tell me what the correct syntax is? Also when i export data how do i format the columns or cells ? thank you very much for helping.
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 10 Nov 2008, 05:51 AM
Hello Duy,
You can try out the following code, where the column UniqueName property is used to hide autogenerated columns on exporting. The UniqueName for AutoGenerated Columns will be same as its DataField.
cs:
For more information on exporting you can refer to the following link
Exporting tips and tricks
Thanks
Princy.
You can try out the following code, where the column UniqueName property is used to hide autogenerated columns on exporting. The UniqueName for AutoGenerated Columns will be same as its DataField.
cs:
protected void ExportButton_Click(object sender, EventArgs e) |
{ |
RadGrid1.MasterTableView.GetColumnSafe("ColumnUniqueName").Visible = false; |
RadGrid1.ExportSettings.ExportOnlyData = true; |
RadGrid1.ExportSettings.OpenInNewWindow = true; |
RadGrid1.MasterTableView.ExportToExcel(); |
} |
For more information on exporting you can refer to the following link
Exporting tips and tricks
Thanks
Princy.
0
appdev
Top achievements
Rank 1
answered on 10 Nov 2008, 12:05 PM
thank you and sorry my english isn't good. what i meant is to hide column when display on the web. and for exporting, i want to make a header column bold with gridline...etc so two separate things. thank you for the other advise now i know how to hide column when exporting. very nice.
0
appdev
Top achievements
Rank 1
answered on 10 Nov 2008, 01:21 PM
anyone could help me?
0
Hello Duy,
This is a possible approach with CSS:
Please modify the code-snippet to use the actual name of your skin.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This is a possible approach with CSS:
<style type="text/css"> |
.GridHeader_yourSkinName |
{ |
border: solid 1px black !important; |
font-weight: bold !important; |
} |
</style> |
Please modify the code-snippet to use the actual name of your skin.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2008, 06:33 AM
Hi Duy,
You can also give a try with the following code snippet which set the style for the Grid header in the click event of the Export Button.
CS:
Thanks
Shinu.
You can also give a try with the following code snippet which set the style for the Grid header in the click event of the Export Button.
CS:
protected void Button1_Click(object sender, EventArgs e) |
{ |
foreach (GridHeaderItem header in RadGrid1.MasterTableView.GetItems(GridItemType.Header)) |
{ |
header.BorderStyle = BorderStyle.Solid; |
header.Font.Bold = true; |
} |
RadGrid1.ExportSettings.OpenInNewWindow = true; |
RadGrid1.MasterTableView.ExportToExcel(); |
} |
Thanks
Shinu.