5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 04 Dec 2012, 05:18 AM
Hi,
Try the following code to achieve your scenario.
C#:
Thanks,
Shinu.
Try the following code to achieve your scenario.
C#:
protected
void
RadGrid2_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExportToPdfCommandName)
{
GridHeaderItem item = (GridHeaderItem)RadGrid2.MasterTableView.GetItems(GridItemType.Header)[0];
foreach
(TableCell cell
in
item.Cells)
{
cell.Style.Add(
"font-weight"
,
"bold"
);
}
}
}
Thanks,
Shinu.
0
Radha
Top achievements
Rank 1
answered on 04 Dec 2012, 05:14 PM
Thanks for the reply.
Unfortunately it is not working if i write the foreach loop in item command.so can please suggest me other ways to set the style to column header.
Below is the code :
}
}
Unfortunately it is not working if i write the foreach loop in item command.so can please suggest me other ways to set the style to column header.
Below is the code :
protected
void radGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridHeaderItem && isExport)
{
foreach (TableCell cell in e.Item.Cells)
{
cell.Style.Add(
"font-weight", "bold");
cell.Style.Add(
"border-width", "thin");
cell.Style.Add(
"font-family", "Verdana");
cell.Style.Add(
"border-style", "solid");
cell.Style.Add(
"font-size", "8pt");
}
}
}
0
Shinu
Top achievements
Rank 2
answered on 05 Dec 2012, 05:18 AM
Hi,
Try modifying the code as shown below.
C#:
Thanks,
Shinu.
Try modifying the code as shown below.
C#:
bool
isexport =
false
;
protected
void
RadGrid2_ItemCreated(
object
sender, GridItemEventArgs e)
{
isexport =
true
;
if
(e.Item
is
GridHeaderItem && isexport)
{
foreach
(TableCell cell
in
e.Item.Cells)
{
cell.Style.Add(
"font-weight"
,
"bold"
);
cell.Style.Add(
"font-family"
,
"Verdana"
);
cell.Style.Add(
"font-size"
,
"8pt"
);
}
}
}
Thanks,
Shinu.
0
Radha
Top achievements
Rank 1
answered on 05 Dec 2012, 09:06 AM
Still the issue exists even if i set the isexport true.
0
Radha
Top achievements
Rank 1
answered on 06 Dec 2012, 10:05 AM
Hi shinu,
I solved the issue to set the header text to bold.In our code somewhere after apply font-weight to bold for each cell,we are setting the header text as
so i replaced bold tag with span as below:
"<span style='font-family:Verdana;font-weight:bold'>Test</span>"; and removed the cell style and it worked well.
Thanks for the support.
Radha
I solved the issue to set the header text to bold.In our code somewhere after apply font-weight to bold for each cell,we are setting the header text as
"<b>Test</b>"
; because of the bold tag while rendering it was not taking the style that i applied as you suggested above.
so i replaced bold tag with span as below:
"<span style='font-family:Verdana;font-weight:bold'>Test</span>"; and removed the cell style and it worked well.
Thanks for the support.
Radha