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

Can not modify RadNumericTextBox style in RadGrid Footer

3 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 21 Mar 2012, 04:55 AM
Dear Support:
i need to modify css of textbox in RadGrid footer template when page load. 
I have tried many times, still can not work, i don't know why, pls help me! Thanks!

Code is below:
function Load(sender, args) {
                sumInput = sender;
 
                sender.get_styles().EnabledStyle[0] += "color:Red;";
                sender.updateCssClass();
            }
<telerik:RadGrid ID="grdPlans" runat="server" AutoGenerateColumns="false">
                        <MasterTableView EditMode="InPlace" ShowFooter="True" TableLayout="Fixed" DataKeyNames="ProjectId">
                            <Columns>
                                <telerik:GridBoundColumn DataField="ProjectId" HeaderText="Project Id">
                                    <HeaderStyle Width="10%" />
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="Jan" DataField="Jan" UniqueName="Jan">
                                    <ItemTemplate>
                                        <telerik:RadNumericTextBox ID="txbMonth1" runat="server" Text='<%#Bind("Jan") %>'
                                            Width="50px" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                            NumberFormat-DecimalDigits="1" MinValue="0" MaxValue="150">
                                            <ClientEvents OnBlur="Blur1" OnFocus="Focus1" />
                                        </telerik:RadNumericTextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <telerik:RadNumericTextBox ID="txbTotal1" runat="server" ReadOnly="true" NumberFormat-DecimalDigits="1"
                                            Width="50px">
                                            <ClientEvents OnLoad="Load" />
                                        </telerik:RadNumericTextBox>
                                    </FooterTemplate>
                                </telerik:GridTemplateColumn>

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Mar 2012, 06:11 AM
Hello James,

You can try the following approach to set backcolor for RadNumericTextBox.
aspx:
<telerik:RadNumericTextBox  ReadOnly="true"  ID="txbTotal1" ReadOnlyStyle-BackColor="Red" runat="server" NumberFormat-DecimalDigits="1" Width="50px">
</telerik:RadNumericTextBox>

Thanks,
Shinu.
0
James
Top achievements
Rank 1
answered on 21 Mar 2012, 08:03 AM
Hi Shinu,
Appreciate for you replay.

I need to modify rad textbox forecolor by client script if some condition changed.

Regards,
James

0
Shinu
Top achievements
Rank 2
answered on 22 Mar 2012, 06:43 AM
Hello James,

Since you are setting ReadOnly property for RadNumericTextBox, try setting ReadOnlyStyle as shown below.
JS:
function Load(sender, args)
{
 sender.get_styles().ReadOnlyStyle[0] += "color: red;";
 sender.updateCssClass();
}

Thanks,
Shinu.
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
James
Top achievements
Rank 1
Share this question
or