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

[Solved] Q3 2008 Missing GetValue() Method ?

7 Answers 169 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 25 May 2009, 06:07 AM
Guys

Why is GetValue() method undefined in the Q3 2008 combo box. Is this dues to either.

a) inside Update Panel
b) Is there is new ver
c) i am using the Items_requested model

if b) can you explain how i can get the value via client side without having get approval for an upgrade

Thanks in advance

Justin

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 May 2009, 07:58 AM
Hi Justin,

I guess you are using RadControls for ASP.NET AJAX version. If so you can use methods get_text() and get_value() in order to get text and value respectively. See the example.

ASPX:
    
<asp:UpdatePanel  ID="UP1" runat="server">        
    <ContentTemplate>       
        <telerik:RadComboBox ID="RadComboBox1" runat="server" >         
           <Items>         
               <telerik:RadComboBoxItem Text="Text1" Value="Value1"></telerik:RadComboBoxItem>         
               <telerik:RadComboBoxItem Text="Text2" Value="Value2"></telerik:RadComboBoxItem>         
                . . .                    
           </Items>         
        </telerik:RadComboBox>       
    </ContentTemplate>       
</asp:UpdatePanel>     
<input id="Button1" type="button" value="Alert Selected" onclick="getSelected();" />    
 

JavaScript:
 
<script type="text/javascript">  
function  getSelected()  
{  
    var combo = $find('<%=RadComboBox1.ClientID %>');      
    var value = combo.get_value();  
    var text = combo.get_text();      
    alert("Selected Text  :" + text);  
    alert("Selected Value :" + value);  
}  
</script> 

Refer the following links which explains, how to get the client side object and about important client side methods of RadComboBox.
Client-Side Basics
RadComboBox object

Thanks,
Princy.
0
Justin
Top achievements
Rank 1
answered on 26 May 2009, 12:27 AM
Princy

1) Why is the online documentation different to your sugestion ie. GetValue() Online & get_value() yours....!!!!!!!!

2)    var par = document.getElementById('<%=rccorp.ClientID %>');
        var combo = $find('<%=rccorp.ClientID %>');  
        var val=combo.get_value();

$find method returns null and document.getElementbyid says get_value() undefined

This script is executed in a content page

Am I missing something here. ????
0
Princy
Top achievements
Rank 2
answered on 26 May 2009, 07:27 AM

Hi Justin,

I guess you are using RadControls for ASP.NET AJAX version and refering to the help article for ASP.NET version. You can find required client side methods for the AJAX controls in the above given help article.

You could find the client side methods used for RadComboBoxItem of AJAX version of RadControls by going through following link.
RadComboBoxItem client side methods

Thanks,
Princy.

0
Justin
Top achievements
Rank 1
answered on 27 May 2009, 12:42 AM
Princy

var combo = $find('<%=rccorp.ClientID %>');




The $find method returns a null value.

Also RadComboBox has a GetValue method that is undefined. Do i need to get a RadComboBoxItem and then try get_value etc ??
0
Atanas Korchev
Telerik team
answered on 27 May 2009, 08:02 AM
Hello Justin,

You may be using a different version of RadComboBox. Please let us know the assembly which RadComboBox comes from. Is it Telerik.Web.UI.dll (RadComboBox for ASP.NET Ajax) or is it RadComboBox.Net2.dll (RadComboBox classic)? Those are two different versions of RadComboBox and have different client-side API. The GetValue method indicates that you may be using RadComboBox Classic. In that case to get a client-side reference to the combobox object you need:

var combobox = window["<%= RadComboBox1.ClientID%>"];

If you are using RadComboBox for ASP.NET Ajax you should use the $find method to get client-side reference and the get_value() method to get the value. There is one catch though - if you call $find too early it will not find anything as RadComboBox's client-side object is not yet initialised. For example the following will not work:

<telerik:RadComboBox ID="RadComboBox1" runat="server" />
<script>

 var combobox = $find("<%= RadComboBox1.ClientID %>"); //combobox will be null
</script>

The workaround is to use the pageLoad javascript method which is fired after all controls have been initialized:

<script >
var combobox = null;
function pageLoad()
{
     combobox = $find("<%= RadComboBox1.ClientID %>");
}
</script>

I hope this helps,
Albert
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
Justin
Top achievements
Rank 1
answered on 27 May 2009, 11:44 PM
Princy

Thanks for clearing up that discrepency. I was starting to get really worried to as what the fruit cake was going on.  

We purchased our licence for  Q3 2008 ASP.net. Currently I should be able to download at least that version of ASP.NET AJAX. Currently I dont have access to nothing. Can you please provide a link etc so I can get access to at least that version of the controls.

I am in the process of renewing my subscription but also i noticed that I dont have any renewal options ???? Can you please also see what that is about.

I have been a happy Telerik customer & want to continue to do so.

Regards

Justin Oehlmann
Snr .NET Analyst Finanace Operations (NAB)National Australia Bank
0
Paul
Telerik team
answered on 28 May 2009, 02:20 PM
Hi Justin,

Actually, there's no need to request this from us (Telerik), but from the person responsible for your company's purchase. Here's the situation. We have seven product lines:

  • RadControls for ASP.NET AJAX
  • RadControls for ASP.NET (discontinued development)
  • RadControls for WinForms
  • RadControls for WPF
  • RadControls for Silverlight
  • Telerik Reporting
  • Telerik OpenAccess ORM

If you are added (from the person responsible for your company's purchase) as a licensed developer to RadControls for ASP.NET only, you won't have access from your Client.net account to the rest of the product lines.

For your convenience we have updated your account and now you should be able to download the controls your company has purchased.

All the best,
Paul
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.
Tags
ComboBox
Asked by
Justin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Justin
Top achievements
Rank 1
Atanas Korchev
Telerik team
Paul
Telerik team
Share this question
or