client side changes not found server side.

1 Answer 87 Views
DropDownList
Itamar
Top achievements
Rank 1
Iron
Iron
Itamar asked on 07 Jun 2021, 11:51 AM

I have a RadDropDownList with countries ,based a client Event I have a javacript loop selecting the country I want,

I then have an OnselectedIndexchangevent which fires after the JS has selected the country ,however when the event fires it does not retrieve the item that was selected by the JS,(the Js is working correctly).It just returns the first item in the list,

I also tried to store the value of the country in a hidden field which doesn't appear on client side either.

Any solutions would be amazing.

Thank You,

Vessy
Telerik team
commented on 10 Jun 2021, 06:26 AM

Hi Itamar,
Can you prepare and send a sample project where we can reproduce the described behavior and examine the setup leading to it?

1 Answer, 1 is accepted

Sort by
0
Mohd
Top achievements
Rank 2
Iron
answered on 15 Oct 2021, 11:20 PM

Posting back to server causes loss of client side changes, except TextBoxes text remains and accepted by the server. Based on that I suggest the following "turn around":

1- Create ASP TextBox (hide it by style="display:none;").

2- Let you JS store the selected index into this TextBox.

3- In code behind:

If Not IsPostBack Then

 Else

      'HERE: YourDDL.SelectedIndex = Cint(TextBox.Text)

 End If

 

good luck!

Tags
DropDownList
Asked by
Itamar
Top achievements
Rank 1
Iron
Iron
Answers by
Mohd
Top achievements
Rank 2
Iron
Share this question
or