Titlebar custom control problem

4 posts, 1 answers
  1. khathu
    khathu avatar
    8 posts
    Member since:
    Nov 2010

    Posted 16 Nov 2010 Link to this post

    Hi,

    I need to have a dropdown in the titlebar of my "Weather" dock widget and have it sending city values to my custom "Weather" control.
    I am struggling to pass the slected value to my ObjectDataSource's ControlID. Is my request possible at all?

    The dropdown works fine inside the Weather control but will look much better if its part of the dock's titlebar.

    <telerik:RadDock ID="Weather" Runat="server" Width="300px" Skin="MyCustomSkin" EnableEmbeddedSkins="false" 
                                                EnableRoundedCorners="True" BackColor="#F3F3F3" 
    BorderStyle="None" Title="Weather" AutoPostBack="True"  >
      
      
                                           <ContentTemplate>
                                                         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate
            
      
            <%-- INCLUDE CONTENT - WEATHER --%>
                               
                                            <content:Weather ID="Weather1" runat="server"></content:Weather></ContentTemplate>  
         </asp:UpdatePanel>
                                           </ContentTemplate>
                                        </telerik:RadDock>
      
      
      
      
    <asp:XmlDataSource ID="XmlWeather" runat="server"></asp:XmlDataSource>
                                                   <telerik:RadComboBox ID="CityList" Runat="server" AutoPostBack="true">
                                                   <Items>
                                                   <telerik:RadComboBoxItem Text="Bloemfontein" Value="Bloemfontein"  />
                                                   <telerik:RadComboBoxItem Text="Cape Town" Value="Cape Town"/>
                                                   <telerik:RadComboBoxItem Text="Durban" Value="Durban"/>
                                                   <telerik:RadComboBoxItem Text="East London" Value="East London"/>
                                                   <telerik:RadComboBoxItem Text="Johannesburg" Value="Johannesburg"/>
                                                   <telerik:RadComboBoxItem Text="Nelspruit" Value="Nelspruit"/>
                                                   <telerik:RadComboBoxItem Text="Pietermaritzburg" Value="Pietermaritzburg"/>
                                                   <telerik:RadComboBoxItem Text="Polokwane" Value="Polokwane"/>
                                                   <telerik:RadComboBoxItem Text="Port Elizabeth" Value="Port Elizabeth"/>
                                                   <telerik:RadComboBoxItem Text="Pretoria" Value="Pretoria"/>
                                                   </Items>
      
      
      
    <asp:ObjectDataSource ID="WeatherFeed" runat="server" 
        SelectMethod="GetForecast" TypeName="xxx.Controls.Conditions">
        <SelectParameters>
            <asp:ControlParameter ControlID="CityList" Name="location" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
     
  2. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 19 Nov 2010 Link to this post

    Hi Khathu,

    The TitleBar template of the RadDock control is INamingContainer, which means the ObjectDataSource will not be able to find the control by passing the ID to the ControlID property. That's why you need to pass the UniqueID of the ComboBox.

    So, please dynamically create the control parameter and get the ComboBox's UniqueID, and then assign it to the ControlID property of the parameter.

    All the best,
    Pero
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. khathu
    khathu avatar
    8 posts
    Member since:
    Nov 2010

    Posted 22 Nov 2010 Link to this post

    Hi Pero,

    Your suggestion sent me in the right directiion and worked well. I was aable to assign the control parameter at run-time but my problem arose when I tried to do the following:

    DropDownList ddl = (DropDownList)NewsFeed.FindControl("DropDownList1");
      
      
      
                if (IsPostBack)
                {
      
                    ObjectDataSource1.SelectParameters.Clear();
                    ControlParameter cp = new ControlParameter("name", ddl.ID, "SelectedValue");
                    ObjectDataSource1.SelectParameters.Add(cp);
                }
                else
                {
                    ControlParameter cp = new ControlParameter("name", ddl.ID, "SelectedValue");
                    ObjectDataSource1.SelectParameters.Add(cp);
                }


    I could not "FindControl" my way to the dropdownlist in the title template. I eventually went the way below:

     

     

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"

     

     

     

    SelectMethod="Gethuman" TypeName="Test._Default">

     

     

     

    <SelectParameters>

     

     

     

    <asp:ControlParameter ControlID="ctl00$MainContent$NewsFeed$T$DropDownList1" Name="name"

     

     

     

    PropertyName="SelectedValue" Type="String" />

     

     

     

    </SelectParameters>

     

     

     

    </asp:ObjectDataSource>

     



  5. khathu
    khathu avatar
    8 posts
    Member since:
    Nov 2010

    Posted 23 Nov 2010 Link to this post

    Hi Pero,

    i had missed something, your suggestion worked!!

    Thanks,
Back to Top