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

RadComboBox to populate within RadPanelBar

5 Answers 141 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Wendy Hunt
Top achievements
Rank 2
Wendy Hunt asked on 23 Dec 2009, 09:34 PM
I have a ComboBox within the PanelBar.  I can populate the ComboBox with a page load call that is located outside the panelbar, but within the bar, I'm not sure how to get the ComboBox to update.  A co-worker suggested adding a RadAjaxManager piece that didn't work either.  Here is what I have so far:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" style="z-index:1; position:absolute; top:2500px;left:10px;">  
      <telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="SingleExpandedItem" Width="740px">  
        <Items> 
            <telerik:RadPanelItem Expanded="True" Text="Step 1: Test" runat="server" Selected="true">   
                <Items> 
                    <telerik:RadPanelItem Value="AccountInformation" runat="server">  
                        <ItemTemplate> 
                            <div style="background-color: #edf9fe">  
          
        <asp:Label ID="Label12" runat="server" Text="Project Search" style="width: 137px; font-weight: 700;"></asp:Label><br /> 
         
        <asp:Label ID="Label9" runat="server" Text="Project Name:" style="width: 113px; text-align: right;"></asp:Label><br /> 
            
        <telerik:RadComboBox ID="projectNameRadComboBox" runat="server" AutoPostBack="true"  ZIndex="99999" Width="250px"></telerik:RadComboBox><br /> 
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" > 
            <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                            <UpdatedControls> 
                                <telerik:AjaxUpdatedControl ControlID="RadAjaxManager1" /> 
                                          
                                <telerik:AjaxUpdatedControl ControlID="projectNameRadComboBox" /> 
                            </UpdatedControls> 
                     </telerik:AjaxSetting> 
            </AjaxSettings> 
         </telerik:RadAjaxManager> 
        <asp:Label ID="Label2" runat="server" Text="Identifier:"></asp:Label><br /> 
           
        <asp:TextBox ID="identifierTextBox" runat="server" Width="250px"></asp:TextBox><br /> 
          
        <asp:Label ID="Label13" runat="server" Text="Project Group:" style="text-align: right;"></asp:Label><br /> 
            
        <telerik:RadComboBox ID="projectGroupRadComboBox" runat="server"  ZIndex="99999" Width="250px"></telerik:RadComboBox><br /> 
          
        <asp:Button ID="projectSearchButton" runat="server" Text="Search" SkinID="smallGreenButton" Width="50px" onclick="projectSearchButton_Click" /><br /> 
                                <br /> 
                                <br /> 
                                <br /> 
    
 
                            </div> 
                        </ItemTemplate> 
                    </telerik:RadPanelItem> 
                </Items> 
            </telerik:RadPanelItem> 

This is my code behind piece that works for populating outside of the PanelBar:
        IQueryable allProjectName = Project.GetAllBindings();  
        this.projectNameRadComboBox.DataSource = allProjectName;  
        this.projectNameRadComboBox.DataValueField = "ID";  
        this.projectNameRadComboBox.DataTextField = "Name";  
        this.projectNameRadComboBox.DataBind();  
 
        this.projectNameRadComboBox.Filter = RadComboBoxFilter.Contains;  
 
 


I want to understand how the ajax is going to make a call from within the PanelBar for the ComboBox.  Thanks!

wen

5 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 24 Dec 2009, 05:31 AM
Hi Wendy,

Access the PanelBar item where the RadComboBox is placed and get reference to combo using the FindControl() method as shown below.

CS:
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        RadPanelItem item = (RadPanelItem)RadPanelBar1.FindItemByValue("AccountInformation"); 
        RadComboBox combo = (RadComboBox)item.FindControl("projectNameRadComboBox"); 
        // Popupate the combo 
        combo.Items.Add(new RadComboBoxItem("New")); 
    } 

-Shinu.
0
Wendy Hunt
Top achievements
Rank 2
answered on 24 Dec 2009, 04:34 PM
Hi Shinu -

It worked... thank you so much!!

RadPanelItem AccountInformationItem = (RadPanelItem)RadPanelBar1.FindItemByValue("AccountInformation");  
          
        RadComboBox projectNameRadComboBox = (RadComboBox)AccountInformationItem.FindControl("projectNameRadComboBox");  
        IQueryable allProjectName = Project.GetAllBindings();  
        projectNameRadComboBox.DataSource = allProjectName;  
        projectNameRadComboBox.DataValueField = "ID";  
        projectNameRadComboBox.DataTextField = "Name";  
        projectNameRadComboBox.DataBind();  
 
        projectNameRadComboBox.Filter = RadComboBoxFilter.Contains; 

:)
wen
0
Daniel
Top achievements
Rank 1
answered on 01 Oct 2010, 02:49 PM
Hello Friend

I am looking for a solution about my trouble with the radgrid+ radpanelbar, and I didn't find yet. 
When I click on buttongrid to add a new item ("InitInsert") my rad grid disappears ! I create some events on radpanelbar_Itemdatabound:
Protected Sub rpbConcorrencia_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs)
        Dim item As RadPanelItem = DirectCast(e.Item, RadPanelItem)
        Dim level As Integer = item.Level
        If level = 1 Then
            Dim rdgAnaliseConcorrencia As RadGrid = DirectCast(CType(e.Item.FindControl("rdgAnaliseConcorrencia"), RadGrid), RadGrid)

            AddHandler rdgAnaliseConcorrencia.InsertCommand, AddressOf rdgAnaliseConcorrencia_InsertCommand
            AddHandler rdgAnaliseConcorrencia.DeleteCommand, AddressOf rdgAnaliseConcorrencia_DeleteCommand
            AddHandler rdgAnaliseConcorrencia.NeedDataSource, AddressOf rdgAnaliseConcorrencia_NeedDataSource
            AddHandler rdgAnaliseConcorrencia.UpdateCommand, AddressOf rdgAnaliseConcorrencia_UpdateCommand
            AddHandler rdgAnaliseConcorrencia.ItemCommand, AddressOf rdgAnaliseConcorrencia_ItemCommand
            AddHandler rdgAnaliseConcorrencia.ItemDataBound, AddressOf rdgAnaliseConcorrencia_ItemDataBound

            item.Controls.Add(rdgAnaliseConcorrencia)

        End If
    End Sub

I am using a radajaxpanel too !

Could you help me in this case ?? (Sorry for my poor English)
0
Iana Tsolova
Telerik team
answered on 06 Oct 2010, 11:13 AM
Hello Daniel,

The described issue can appear in can the grid is not bound properly. Could you please confirm that the code for binding the grid is only the one available in the NeedDataSource event handler where you just need to set the RadGrid DataSource property, and this property is not set elsewhere nor the DataBind() method is called for the grid? If that is true, then try attaching the event handlers on ItemCreated of the RadPanelBar instead of on ItemDataBound and see if it makes any difference.

Regards,
Iana
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
Daniel
Top achievements
Rank 1
answered on 06 Oct 2010, 01:42 PM
Hey Iana

Thanks for replay !! But I got solve this matter ont his weekend !!

As I create the event handler on databind of Panelbar, it was necessary to create on Aspx : OnUpdateCommand ="rdgAnaliseConcorrencia_UpdateCommand" for each event handler ! I don't know VB very well, so I didn't Know how these events behave !!

Once more, thanks for help !! (Sorry again for my poor English)
Tags
PanelBar
Asked by
Wendy Hunt
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Wendy Hunt
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or