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

Display RadComboBox Selections

1 Answer 80 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Arnold Smith
Top achievements
Rank 1
Arnold Smith asked on 10 Jul 2009, 09:48 PM
Hello Telerik,

Here is the scenario:

I have created 4 RadComboBoxes, each containing data selections, retrieved dynamically, in the form of CheckBoxes. I would like to enable users to view their selections before submitting. I saw a Telerik example wherein the selections were displayed in the input text field of a RadComboBox, but that is too limiting for the numbers of data items the boxes will contain.

I reviewed the Dock control and an example of dynamic creation and thought that this would be perfect for the project provided I could get everything working properly. I implemented the idea nearly successfully for one box. Perhaps someone can help me with the issues I'm facing.

1. The Dock disappears on a postback. I'd like for the user to be able to see the contents of all the boxes at once. Thus, the postback issue only permits only one display of a RadDock control at a time.
2. I tried to format the list of box items using: \r\n. However, the display of contents wrapped, ignoring carriage return and line feed.
3. I tried to manually insert a ListBox into the markup, but that control is rejected. It's not a valid RadDock object.
4. I've thought of using a RadGrid, but manipulating its contents within a RadDock control using javascript seems a little daunting. I would have to handle switching the visibility off the RadDock in javascript, too, since it should not be visible unless summoned.
5. I think adding a RadGrid server side into a dynamically created RadDock would be OK, but I don't know how to do that.

Basically, I want:

  1. Display on demand for each of the ComboBoxes
  2. Persistence of all the displays through postbacks, until the user dismisses the control
  3. The kind of data legibility and organization that can be achieved using a ListBox or a Grid

Do you have some suggestions/examples for a Telerik beginner?

Thank you in advance,

Arnold

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 15 Jul 2009, 12:48 PM
Hello Arnold,

In reference to your issues:

  1. You need to recreate the RadDock and its content in the Page_Init method. This can be seen in the online demo for dynamic dock creation. 
  2. From the information provided I could not exactly figure out how are you trying to insert new lines in the dock's content, but you should try using <br/> like shown in the source code pasted under 3.
  3. I created a simple project with a RadDock that has a <asp:ListBox> inside. Everything seems to be working fine. Here is the source code:
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head id="Head1" runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
        <div> 
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
                <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px" Width="300px"
                    <telerik:RadDock ID="RadDock1" runat="server" Width="300px" Title="RadDock-Title"
                        <ContentTemplate> 
                            <br /> 
                            <br /> 
                            <br /> 
                            <br /> 
                            <br /> 
                            <asp:ListBox ID="ListBox1" runat="server"
                                <asp:ListItem Text="LB Item1"></asp:ListItem> 
                                <asp:ListItem Text="LB Item1"></asp:ListItem> 
                                <asp:ListItem Text="LB Item1"></asp:ListItem> 
                            </asp:ListBox> 
                            <br /> 
                            <br /> 
                            <br /> 
                            <br /> 
                            <br /> 
                        </ContentTemplate> 
                    </telerik:RadDock> 
                </telerik:RadDockZone> 
            </telerik:RadDockLayout> 
        </div> 
         
        <asp:Button ID="button1" runat="server" Text="Make postback" /> 
        </form> 
    </body> 
    </html> 
  4. In order to show/hide the RadDock, the Closed property should be used. You can manipulate this property both on the server and client side. On the server it should be used by setting dock.Closed = true/false, and on the client using the set_closed(boolean value) method find(dockId).set_closed(true/false).
  5. You can explore our demo examples of the RadGrid and the RadDock to see how to dynamically add content to the dock. Also, in order to get a reference to the RadGrid placed in the dock you need to use the Dock.ContentContainer.FindControl(RadGridID).


Regards,
Pero
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
Dock
Asked by
Arnold Smith
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or