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

Color disappeared after postback

1 Answer 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vitaly
Top achievements
Rank 1
Iron
Iron
Vitaly asked on 27 Feb 2020, 08:57 PM

Hi,

I have telerik control which i set a color after cursor leaves:

<telerik:RadTextBox ID="txtText4" runat="server" Font-Bold="true" TabIndex="4" Font-Size="Small"
                                   Width="40%" CssClass="upper" onKeyUp="Count(this,30)" onChange="Count(this,30)" Height="21" style="border-width:2px; font-family:Verdana;">
                                   <DisabledStyle Font-Bold="true" BackColor="#EFEFEF"  />
                                    <ClientEvents OnFocus="OnFocus" OnBlur="OnBlur" />
                                 </telerik:RadTextBox>

 

On client event blur backcolor became blue when it leaves this control.

After that cursor transfer to the next control with autopostback=true:

<telerik:RadComboBox ID="ddlAprv" runat="server" TabIndex="6" AutoPostBack="true" Font-Bold="true" Font-Size="Small" Width="75px" OnSelectedIndexChanged="ddlAprv_SelectedIndexChanged1" style="border-width:2px; font-family:Verdana;"
                                    OnClientFocus="OnFocus" >
                                 <Items>
                                      <telerik:RadComboBoxItem Text="Select" Value="" Selected="true" />
                                      <telerik:RadComboBoxItem Text="Yes" Value="Y"  />
                                      <telerik:RadComboBoxItem Text="No" Value="N" />
                                 </Items>
                               </telerik:RadComboBox>

 

For the some reason blue color on the previous control disappeared.

I would like that color stay all the time.

Please help.

Vitaly.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Mar 2020, 05:26 AM

Hi Vitaly,

 

It is expected for this kind of changes made on client-side not to go to server-side and hence, not being preserved on page postbacks.

You can use a HiddenField to keep the color of the textbox and apply it using the pageLoad or ClientEvents.OnLoad event handler:
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.hiddenfield?view=netframework-4.8

I hope this will prove helpful.

 

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Vitaly
Top achievements
Rank 1
Iron
Iron
Answers by
Eyup
Telerik team
Share this question
or