This is a migrated thread and some comments may be shown as answers.

[Solved] change textbox color

2 Answers 310 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 28 Aug 2012, 03:50 AM
Hi,
How do i change the color of all the TextBox controls in edit form.

Savyo

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Aug 2012, 05:05 AM
Hi Savyo,

Try the following code snippet to change the color of all BoundColumns in edit mode.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem editItem = (GridEditableItem)e.Item;
        foreach (GridColumn col in rasd1.MasterTableView.Columns)
        {
            if (col.ColumnType == "GridBoundColumn")
            {
                TextBox txt = (TextBox)editItem[col.UniqueName].Controls[0];
                txt.CssClass = "InlineGridFont";
            }
        }
    }
}

CSS:
<style>
    .InlineGridFont
    {
        background-color:Red ! important;
    }
</style>

Thanks,
Princy.
0
Daniel
Top achievements
Rank 1
answered on 24 May 2013, 02:33 AM
Hey Princy!    Yet another great snippet!

This fixed my issue with trying to get the BlackMetroTouch theme to stop rendering white text on white background in generated edit text boxes.

Worked like a charm.  Just thought I'd stop and say...

THANKS!   

-= Daniel
Tags
Grid
Asked by
Savyo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Share this question
or