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

DropDownList and value

13 Answers 207 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Paweł
Top achievements
Rank 2
Paweł asked on 21 Aug 2009, 04:20 PM
Hello,

I try to get decorated DropDownList value after change.
I'm using jQuery to add event like this

var select = $('#<%= ddlControl.ClinetID %>');
select.change(function() {
    alert($(this).val());
});

event is trigered correctly, but value is always 0. I did also inspect <select> in DOM inspector, and there is also always value = 0.

So, how to get this value if it's not changing?

Gr,
Pawel

13 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 24 Aug 2009, 12:13 PM
Hello Paweł,

Here is a small sample that shows how to achieve this:

<head id="Head1" runat="server"
    <title></title
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
    <telerik:RadFormDecorator ID="FormDec1" runat="server" DecoratedControls="All" /> 
    <asp:DropDownList ID="ddlControl" runat="server"
        <asp:ListItem Value="1"></asp:ListItem> 
        <asp:ListItem Value="2"></asp:ListItem> 
        <asp:ListItem Value="3"></asp:ListItem> 
        <asp:ListItem Value="4"></asp:ListItem> 
    </asp:DropDownList> 
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
 
        <script type="text/javascript"
            var select = $('#<%= ddlControl.ClientID %>'); 
            select.change(function() 
            { 
                alert($(this).val()); 
            }); 
        </script> 
 
    </telerik:RadScriptBlock> 
    </form> 
</body> 

I hope this helps.

Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Paweł
Top achievements
Rank 2
answered on 25 Aug 2009, 03:46 PM
Hello Georgi,

Thanks for replay, my code is 90% similar to yours, but still displays always 0.
I tried your code on a blank new project and result was the same, it alwayd display 1 (first value from drop down).
If i disable form decorator it works correct.

Print screen while changeinf value 3 to 2: http://cbm.yetiz.pl/telerik/formdecorator_change.jpg
And also screen from FireBug DOM inspector, you can sse that even if 3 is selected the value is still "1": http://cbm.yetiz.pl/telerik/formdecorator_change.jpg

Gr,
Paweł
0
Georgi Tunev
Telerik team
answered on 27 Aug 2009, 12:08 PM
Hello Paweł,

Are you using Firefox? I am asking you this because the code is working fine with IE, but we noticed that there is a problem with RadFormDecorator's Selects  and Firefox. We are currently working on this problem and once we have a solution, I will post it here.

Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Martin
Telerik team
answered on 28 Aug 2009, 05:54 AM

Hi Paweł,

I believe that the code below will work. It seems that the programatic selection of a dropdown does not behave as expected in FireFox, and we will further investigate the problem.

<script type="text/javascript"> 
var select = $('#<%= ddlControl.ClientID %>'); 
var combo = document.getElementById('<%= ddlControl.ClientID %>');

select.change(function() 
{
 var skinnedcombo = document.getElementById('Skinned<%= ddlControl.ClientID %>');
 var skinnedoptions = skinnedcombo.getElementsByTagName('LI');
 
 if(navigator.appName == 'Netscape')
 {
  for(var i = 0; i < skinnedoptions.length; i ++)
  {
   combo.options[i].removeAttribute('selected');
   if(skinnedoptions[i].className == 'rfdSelect_selected')
   {
      combo.options.selectedIndex = i;
   }
  }
 }
});
</script>


Kind regards,

Martin Ivanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael
Top achievements
Rank 1
answered on 14 Sep 2009, 06:28 AM
Hi

I am having the same issue on a postback in Firefox. In IE and Safari it works, however when I do a server side postback in Firefox, the first DropDownList item is selected, unless the correct item.

Can anyone assist with this?

Thanks.
0
Martin
Telerik team
answered on 14 Sep 2009, 06:36 AM
Hello Michael,

The issue you have reported is logged in in our to do list and is pending fixing, however at the time being we cannot provide you with a solution.

Regards,
Martin Ivanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
SWAT
Top achievements
Rank 2
answered on 27 Oct 2009, 04:42 PM
Hi Georgi,

We had a rough day today because of the dropdown.value in javascript does not work in firefox when using the formdecorator.
we finally added the ControlsToSkip="Select" tot he decorator, but i want to know if this matter will be fixed in the comming Q3?

Thanks in advance,
Ilan.
0
Georgi Tunev
Telerik team
answered on 28 Oct 2009, 01:32 PM
Hello Ilan,

Yes, the fix is ready and will be present in the Q3 release next week.


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kurt
Top achievements
Rank 1
answered on 28 Oct 2009, 04:38 PM
That is great news, as I just spent the last two hours tracing this issue.,.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 Nov 2009, 11:41 AM
Hello,

I just downloaded Q3 and now my DropDownList is no longer styled by RadFormDecorator in IE an FF?

Please advice.

Marc
0
Georgi Tunev
Telerik team
answered on 12 Nov 2009, 12:22 PM
Hi Marc,

The decoration of SELECT elements is working fine in our demo, so I assume that the reason for the problem could be in the configuration or the logic that you are using. Please open a support ticket and send us a small sample project so we could investigate.


Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 Nov 2009, 12:34 PM
Hi Georgi,

I found that the problem is that I have a CssClass defined on the DropDownList.
In previous versions the select was styled by RadFormDecorator anyway but in Q3 not anymore.

Is this a bug or intended behavior?

BR,
Marc
0
Georgi Tunev
Telerik team
answered on 12 Nov 2009, 12:44 PM
Hi Marc,

Yes, by design RadFormDecorator will not decorate controls that have class property - in such case we assume that the developer wants to control the look of the component.


All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
FormDecorator
Asked by
Paweł
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Paweł
Top achievements
Rank 2
Martin
Telerik team
Michael
Top achievements
Rank 1
SWAT
Top achievements
Rank 2
Kurt
Top achievements
Rank 1
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or