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

Unable to get RadComboBox ClientID

2 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rama Rao
Top achievements
Rank 1
Rama Rao asked on 10 Sep 2010, 03:47 PM
Hi,

     I am unable to get the ClientID fo the Rad Combo box control ($find("<%= rComboResultsPerPage.ClientID %>") which is present in the Pager Template of the Rad Grid. Is there any way to fetch it? I have pasted my working code below.


<script type="text/javascript">
        function pageLoad(sender, args) {
                gridCount = parseInt(document.getElementById("<%= hidGridCount.ClientID %>").value);
                if (gridCount > 0)
               var  tableView = $find("<%= radgridEventSearch.ClientID %>").get_masterTableView();
              var savedValue = $get("RadComboBox1Value").value;
                  var combo = $find("<%= rComboResultsPerPage.ClientID %>");
              if (savedValue != "" && combo.findItemByValue(savedValue)) {
                            combo.findItemByValue(savedValue).select();
                        }
        }

</script>

<telerik:RadGrid ID="radgridEventSearch" runat="server" GridLines="None" AllowPaging="True"
                                EnableViewState="false" AllowCustomPaging="true" VirtualItemCount="1000000" AllowSorting="True"
                                AutoGenerateColumns="false" Skin="Vista" OnSortCommand="radgridEventSearch_SortCommand"
                                OnNeedDataSource="radgridEventSearch_NeedDataSource" PageSize="25">
<MasterTableView AllowCustomSorting="true" AllowNaturalSort="false">
                                    <PagerTemplate>
                                <!-- There is some additional code goes here -->
        <telerik:RadComboBox ID="rComboResultsPerPage" DataSource="<%# FillResultsPerPageDropDownList() %>"
         SelectedValue='<%# (int)DataBinder.Eval(Container, "Paging.PageSize") %>' runat="server"
         OnClientSelectedIndexChanged="rComboResultsPerPage_SelectedIndexChanged" Width="50px">
            </telerik:RadComboBox>
        <!-- There is some additional code goes here -->
         </PagerTemplate>
    <PagerStyle PageButtonCount="10" Position="TopAndBottom" AlwaysVisible="true" />
<!-- There is some additional code goes here -->
<asp:HiddenField ID="hidGridCount" Value="0" runat="server" />                           
<input type="hidden" id="RadComboBox1Value" value="" />

Thanks
Rama Rao

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Sep 2010, 03:52 PM
Hi Rama,

You can't get the RadComboBox client ID in this way, because the Javascript code is not in the same naming container as the RadComboBox.

What you can do is subscribe to the RadComboBox' OnClientLoad event and assign the control id (sender.get_id()) to a global Javascript variable, which will afterwards be used in the pageLoad function.

Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rama Rao
Top achievements
Rank 1
answered on 10 Sep 2010, 04:08 PM
Hi Dimo,

             Thanks for you help. It is working.

Thanks
Rama Rao


 
Tags
Grid
Asked by
Rama Rao
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Rama Rao
Top achievements
Rank 1
Share this question
or