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

Modify style in Server Side Event

1 Answer 69 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Artur
Top achievements
Rank 1
Artur asked on 06 Apr 2016, 03:57 PM

Hi!

I wanted to modify style of RadCombo on server side, something like this:

01.protected void SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
02.    {
03.        var radCombo = sender as RadComboBox;
04.        var parent = radCombo.Parent;
05. 
06.       // cuted...
07. 
08.        int constLeft = 130;
09.        int avgTokenWidth = 73;
10.        int computed = constLeft + (avgTokenWidth * autocomplete.Entries.Count);
11.        radCombo.Style["Left"] = computed.ToString() + " px ! important";
12.    }

 

But it doesn't do anything. How to push these change to the client?

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 11 Apr 2016, 01:10 PM
Hello Artur,

Generally, you can achieve this requirement using the client-side equivalent:
http://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/client-side-programming/events/onclientselectedindexchanged

As for the server-side approach, you will need to use the correct CSS approach depending on your requirements:
protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    RadComboBox combo = sender as RadComboBox;
    combo.Style["margin-left"] = "100px";
}

Regards,
Eyup
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ComboBox
Asked by
Artur
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or