6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 27 Aug 2010, 06:28 AM
Hello Joe,
You can try the following code snippet to set the font name and font size of controls in inplace edit mode.
ASPX:
C#:
Thanks,
Princy.
You can try the following code snippet to set the font name and font size of controls in inplace edit mode.
ASPX:
<
telerik:GridBoundColumn
UniqueName
=
"FirstName"
HeaderText
=
"FirstName"
DataField
=
"FirstName"
>
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
TextBox txt = (TextBox)editItem[
"FirstName"
].Controls[0];
txt.Font.Name =
"Arial"
;
txt.Font.Size = FontUnit.XLarge;
}
}
Thanks,
Princy.
0
Joe
Top achievements
Rank 1
answered on 27 Aug 2010, 04:47 PM
Hi,
I added the code suggested and return the following errors:
Error 1 Cannot convert type 'Telerik.Web.UI.GridItem' to 'Telerik.Web.UI.GridEditableColumn' C:\Intranet\ARInventoryManager\Dashboard.aspx.cs 92 47 ARInventoryManager
Error 2 Cannot apply indexing with [] to an expression of type 'Telerik.Web.UI.GridEditableColumn' C:\Intranet\ARInventoryManager\Dashboard.aspx.cs 93 40 ARInventoryManager
I added the code suggested and return the following errors:
Error 1 Cannot convert type 'Telerik.Web.UI.GridItem' to 'Telerik.Web.UI.GridEditableColumn' C:\Intranet\ARInventoryManager\Dashboard.aspx.cs 92 47 ARInventoryManager
Error 2 Cannot apply indexing with [] to an expression of type 'Telerik.Web.UI.GridEditableColumn' C:\Intranet\ARInventoryManager\Dashboard.aspx.cs 93 40 ARInventoryManager
protected void AstonishInventory_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableColumn editItem = (GridEditableColumn)e.Item;
TextBox txt = (TextBox)editItem["ServerRole"].Controls[0];
txt.Font.Name = "Calibri";
txt.Font.Size = FontUnit.Small;
}
}
0
Joe
Top achievements
Rank 1
answered on 27 Aug 2010, 04:52 PM
Hi,
sorry I had several typos. This is now working from a syntax point of view.
sorry I had several typos. This is now working from a syntax point of view.
0
Joe
Top achievements
Rank 1
answered on 27 Aug 2010, 07:21 PM
Hi,
This works however I want to make a universal feature. I don't want to hard code the text field names but rather determine if it's text then apply the CSS (font size and font name) changes.
This works however I want to make a universal feature. I don't want to hard code the text field names but rather determine if it's text then apply the CSS (font size and font name) changes.
protected void AstonishInventory_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
TextBox txtServerRole = (TextBox)editItem["ServerRole"].Controls[0];
TextBox txtComputerName = (TextBox)editItem["ComputerName"].Controls[0];
TextBox txtIPAddress = (TextBox)editItem["ManagementIp"].Controls[0];
TextBox txtUser = (TextBox)editItem["Username"].Controls[0];
TextBox txtPassword = (TextBox)editItem["Password"].Controls[0];
TextBox txtOS= (TextBox)editItem["OperatingSystem"].Controls[0];
TextBox txtDBType = (TextBox)editItem["DatabaseType"].Controls[0];
TextBox txtContract = (TextBox)editItem["ContractTerms"].Controls[0];
TextBox txtNotes = (TextBox)editItem["Notes"].Controls[0];
SetFontForInlineGridText(txtServerRole);
SetFontForInlineGridText(txtComputerName);
SetFontForInlineGridText(txtIPAddress);
SetFontForInlineGridText(txtUser);
SetFontForInlineGridText(txtPassword);
SetFontForInlineGridText(txtOS);
SetFontForInlineGridText(txtDBType);
SetFontForInlineGridText(txtContract);
SetFontForInlineGridText(txtNotes);
NOTICE THE REDUNDANCY ABOVE
THIS BELOW SECTION IS WRONG. HOW DO I MAKE THIS WORK TO MAKE THIS METHOD MORE GENERIC
foreach (e.Item in editItem)
{
if (e.Item.ItemType = TextBox)
SetFontForInlineGridText(e.Item);
}
}
}
public void SetFontForInlineGridText(TextBox gridtext)
{
gridtext.CssClass = "InlineGridFont";
}
0
Princy
Top achievements
Rank 2
answered on 30 Aug 2010, 09:15 AM
Hello Joe,
You can try the following method to apply the CSS style to all the TextBox controls in edit form.
C#:
Thanks,
Princy.
You can try the following method to apply the CSS style to all the TextBox controls in edit form.
C#:
protected
void
AstonishInventory_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
foreach
(GridColumn col
in
AstonishInventory.MasterTableView.Columns)
{
if
(col.ColumnType ==
"GridBoundColumn"
)
{
TextBox txt = (TextBox)editItem[col.UniqueName].Controls[0];
txt.CssClass =
"InlineGridFont"
;
}
}
}
}
Thanks,
Princy.
0
Joe
Top achievements
Rank 1
answered on 31 Aug 2010, 01:11 PM
Hi,
This worked out great
Thank You very much.
This worked out great
Thank You very much.