Combobox for grid page items number selector

4 posts, 0 answers
  1. David
    David avatar
    10 posts
    Member since:
    Dec 2010

    Posted 17 Dec 2010 Link to this post

    Hello,

    I am using a RadComboBox as a selector for the number of items in a grid. What I have been using this far is the following JavaScript at the page level:

    <

     

    script type="text/javascript">

     

     

    function ddlPageSize_SelectedIndexChanged(sender, args) {

     

     

    var obj = $find("<%= LineItemsGrid.ClientID %>")

     

    tableView = obj.get_masterTableView();

    tableView.set_pageSize(sender.get_value());

    }

    </

     

    script>

     

    This has been working great, however, now we have a page requiring multiple grids. We have been trying for a while to get a reference of the grid's MasterTableView by inspecting both sender and args and navegating the hierarchy. Can you provide some insight as to how this can be achieved?

    Thanks,

    David


  2. David
    David avatar
    10 posts
    Member since:
    Dec 2010

    Posted 13 Sep 2011 Link to this post

    Hello,

    On a related note, same grid, I am in the need of referencing RadComboboxes and call the method that is also called OnClientSelectedIndexChanged.

    More specifically, the JavaScript method that is called has an argument passed into it, which is a Telerik object. The method does things to it, such as enable/disable relative controls, etc... I now need to iterate through all the comboboxes on the grid and call this method on them, but I can't seem to reference them correctly. Here is what I have tried,  which is throwing null exceptions on a call to get_id() from within the method:

                               <ItemTemplate>
                                    <span class="validatable">
                                        <telerik:RadComboBox  ID="ddlHostType" 
                                                              runat="server" 
                                                              DataTextField="Text" 
                                                              DataValueField="Value" 
                                                              AutoPostBack="false"
                                                              CausesValidation="false"
                                                              Width="85px"
                                                              OnClientSelectedIndexChanged="setAvailableHostValues"
                                                              
                                        />
                                        <asp:RequiredFieldValidator ID="vldHostType" 
                                                                    runat="server" 
                                                                    ErrorMessage="Please select a Host ID Type" 
                                                                    ControlToValidate="ddlHostType" 
                                                                    EnableClientScript="false"
                                                                    CssClass="validationErrorMessages"
                                        />
                                    </span>
                                </ItemTemplate>                           <ItemTemplate>
                                    <span class="validatable">
                                        <telerik:RadComboBox  ID="ddlHostType" 
                                                              runat="server" 
                                                              DataTextField="Text" 
                                                              DataValueField="Value" 
                                                              AutoPostBack="false"
                                                              CausesValidation="false"
                                                              Width="85px"
                                                              OnClientSelectedIndexChanged="setAvailableHostValues"
                                                              
                                        />
                                        <asp:RequiredFieldValidator ID="vldHostType" 
                                                                    runat="server" 
                                                                    ErrorMessage="Please select a Host ID Type" 
                                                                    ControlToValidate="ddlHostType" 
                                                                    EnableClientScript="false"
                                                                    CssClass="validationErrorMessages"
                                        />
                                    </span>
                                </ItemTemplate>

    And the script I am calling....


        $(".rcbReadOnly input[type=text]").each(function() { // this is where I think I am referencing incorrectly...
            if (this.id.indexOf("ddlHostType") > -1) {
                var myId = $(this).parents("div").attr("id");

                var cbo = $find(myId);
                if (cbo != null) {
                    setAvailableHostValues($find(myId));
                }
            }
        });
  3. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 19 Sep 2011 Link to this post

    Hi David,

    Try to get the elements which have the "RadComboBox" or "RadComboBox_SkinName" class and then obtain their id attribute. The div element wrapping the RadComboBox has this id attribute and not the input element which you are getting now.

    Greetings,
    Dimitar Terziev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
  4. David
    David avatar
    10 posts
    Member since:
    Dec 2010

    Posted 19 Sep 2011 Link to this post

    Yep. I eventually tried that and it worked. Thanks!
Back to Top