hi , i am using the following code for the change of the Font according to the standard Font stored in DB(which is getting populated previous to this code) . But the Font remains the Standard "Microsoft Sans Serif". I want to change Font of each and every cell. Please suggest..
I also tried the Commented code : as
//e.CellElement.Font = new Font("Marathi Sharda", 10);
but it didnt work...
I also tried the Commented code : as
//e.CellElement.Font = new Font("Marathi Sharda", 10);
but it didnt work...
private void ChangeFont()
{
for (int i = 0; i < DgrdCustomerMaster.Rows.Count; i++)
{
for(int j=0;j<DgrdCustomerMaster.Rows[i].Cells.Count; j++)
{
DgrdCustomerMaster.Rows[i].Cells[j].Style.Font = new Font(DgrdCustomerMaster.Rows[i].Cells["dgrdFont"].Value.ToString(), 10); ;
}
}
}
private
void
ChangeFont()
{
for
(
int
i = 0; i < DgrdCustomerMaster.Rows.Count; i++)
{
for
(
int
j=0;j<DgrdCustomerMaster.Rows[i].Cells.Count; j++)
{
DgrdCustomerMaster.Rows[i].Cells[j].Style.Font =
new
Font(DgrdCustomerMaster.Rows[i].Cells[
"dgrdFont"
].Value.ToString(), 10); ;
}
}
}
private
void
DgrdCustomerMaster_CellFormatting(
object
sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
// e.CellElement.Font = new Font("Marathi Sharda", 10);
ChangeFont();
}
10 Answers, 1 is accepted
0

Richard Slade
Top achievements
Rank 2
answered on 29 Nov 2010, 10:17 AM
Morning,
Hope you're well today.
You should be able to change the font for the entire grid in one go using the following
Hope this helps, but let me know if you have any more questions.
Richard
Hope you're well today.
You should be able to change the font for the entire grid in one go using the following
this
.radGridView1.TableElement.Font =
new
Font(
"Arial"
, 14);
Hope this helps, but let me know if you have any more questions.
Richard
0

Richard Slade
Top achievements
Rank 2
answered on 29 Nov 2010, 10:22 AM
Or just change it for data cells in this way..
Let me know if you need more information
Richard
private
Font m_Font =
new
Font(
"Arial"
, 14);
private
void
RadGridView1_CellFormatting(System.Object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if
(e.CellElement
is
GridDataCellElement) {
e.CellElement.Font = m_Font;
}
}
Let me know if you need more information
Richard
0

Richard Slade
Top achievements
Rank 2
answered on 29 Nov 2010, 10:32 AM
Hello Sagar,
By the way, the font won't change if the font is not specified exactly as it is on the PC or it doesn't exist. So if write add
then this will not change the font face.
However,
will work.
Richard
By the way, the font won't change if the font is not specified exactly as it is on the PC or it doesn't exist. So if write add
e.CellElement.Font =
new
Font(
"Comic Sans"
, 14);
However,
e.CellElement.Font =
new
Font(
"Comic Sans MS"
, 14);
Richard
0

Sagar
Top achievements
Rank 1
answered on 29 Nov 2010, 11:04 AM
Hi, Richard.
Good Morning & Thanks , but what if i have to change the Font of some of the rows only.
Thanks in Adv.
Good Morning & Thanks , but what if i have to change the Font of some of the rows only.
Thanks in Adv.
0

Richard Slade
Top achievements
Rank 2
answered on 29 Nov 2010, 11:09 AM
Hello,
In the same way as you would use CellFormatting, you can also use RowFormatting. Have a look at this documentation link which should help, but if you have any other questions, just let me know.
Regards,
Richard
In the same way as you would use CellFormatting, you can also use RowFormatting. Have a look at this documentation link which should help, but if you have any other questions, just let me know.
Regards,
Richard
0

Richard Slade
Top achievements
Rank 2
answered on 30 Nov 2010, 11:33 AM
Hello Sagar,
Did this help? If so, please mark as answer. If you need more assistance, just let me know.
thanks
Richard
Did this help? If so, please mark as answer. If you need more assistance, just let me know.
thanks
Richard
0

Sagar
Top achievements
Rank 1
answered on 30 Nov 2010, 11:49 AM
Hi, Richard
It has helped but partially as i didnt need to change the Font of buttons text in that row(Sorry for not specifying that clearly in the previous post).So please tell me whether i can get the Column in the RowFormatting event..
Thanks & Regards
Sagar
It has helped but partially as i didnt need to change the Font of buttons text in that row(Sorry for not specifying that clearly in the previous post).So please tell me whether i can get the Column in the RowFormatting event..
Thanks & Regards
Sagar
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 30 Nov 2010, 12:18 PM
Hi Sagar,
You can get to the column or cell that you need via the RowFormatting event in the following way:
hope that helps, but let me know if you need more info
Richard
You can get to the column or cell that you need via the RowFormatting event in the following way:
Private
Sub
RadGridView1_RowFormatting(
ByVal
sender
As
System.
Object
,
ByVal
e
As
Telerik.WinControls.UI.RowFormattingEventArgs)
Handles
RadGridView1.RowFormatting
MessageBox.Show(e.RowElement.RowInfo.Cells(0).Value.ToString())
'E.g. The value of a particulat cell in that row (The CellInfo)
MessageBox.Show(e.RowElement.RowInfo.Cells(0).ColumnInfo.HeaderText)
' E.g. The header text of a particular cell in that row (The ColumnInfo)
End
Sub
hope that helps, but let me know if you need more info
Richard
0

Sagar
Top achievements
Rank 1
answered on 01 Dec 2010, 12:37 PM
Thanks Buddy...
0

Richard Slade
Top achievements
Rank 2
answered on 01 Dec 2010, 12:46 PM
Glad to be able to help Sagar.
All the best
Richard
All the best
Richard