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

How to move dynamically created user controls from Dock Zone to a Panel

3 Answers 85 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Nag M
Top achievements
Rank 1
Nag M asked on 04 Jun 2010, 07:37 AM

Hi Team,

I have to design a Reports page. Using Rad Docks & Rad Tabs. Requirements given below

     
Report Page contains Different Set of Dynamically created User controls. Normally User can add controls from Menu.

User controls in the Reports page can be shown in Two Views. User have a button to switch/change the view.

1) Windows view [ Contains Two Zones, User can dock the controls from One Zone to Other Zone]
2) Tab View [Tabs and Tab pages]

User Can Switch between the views at any time.
- While in Windows View, user can click on “Tabs View” and Tabs page will open with same reports as in Windows view.
- While in Tabs View, user can click on “Windows View” and Windows page will open with same reports as in Tabs view.

User can save the report. Just we will update the User Control Names, Position and ZOne number and other values in the database.

When User Switches from Windows to Tab.. same controls with user selected data should be displayed in the form of Tabs.

When user switches to Tab to Windows.. half of the controls added to first zone and the remaining to second zone.

Note: These controlled are created dynamically

My Approch:

I created two aspx pages one for Windows view and other for Tabs View.
Using Cookies when user switches the view , I am re-creating the same controls in the other page with selected data. vice versa.
But I could not populate the selected data .. But my Client does not want this approch.

He wants it to be done in One page.

His approch is like, One panel for Tabs View and Other Panel for Windows View.
When User switches the view , I have to add all the controls one panel to other panel .. Vice versa.

Please help me how to do this with a good example ? Also please let me know you have any other alternatives.

Thanks in Advance
Nag

3 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 09 Jun 2010, 11:51 AM
Hi Nag,

One panel for the Tabs View and another one for the Windows View, seems like the right approach for your specific scenario. However, I believe ViewState problems might arise when changing the View and adding the controls from the docks to the tabs and vice-versa. So that's why I would recommend adding the user control to both the dock and the tab, and use Visible property of both panels to switch views. This way the same controls will be always added and there shouldn't be any problems with the ViewState.

If your docks and tabs are created dynamically, please note that they must be recreated in the Page.Init, to ensure their proper operation.

Please note that providing custom solutions and projects is out of the scope of our support, so you need to implement the custom logic yourself.

All the best,
Pero
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
Nag M
Top achievements
Rank 1
answered on 09 Jun 2010, 12:13 PM
Hi Pero,

I have already implemented your suggestion. One panel for the Tabs View and another one for the Windows View. Also adding the user control to both the dock and the tab.

I am able to recreate the docks dynamically in the Page_Init. Also I am able to retain the controls state and selected values.  ( used DockState from Demo example)

But I am unable to re-create the Tabs/Page views. I am unable to retain the tabs state ( previously created tab/pageviews information).  How to recreate the tab in Page_Init? How to retain the State of Tabs/Pageviews? ( I have to load the existing tabs and pages)

Also my user control contains Combo boxes. If I change the value, its postbacking, as a result the other dynamically created controls lost its values and loads empty values in the controls. As a temporary solution, I am storing all the control parameter values in Cookies and resetting if the control values are empty. Is they are any other approch to keep the values as it is?

Thanks for your response!

Nag
0
Pero
Telerik team
answered on 14 Jun 2010, 01:44 PM
Hi Nag,

Very similar to the way the docks save their state, you can serialize the values of the properties which you want to persist, and save the serialized string into the session or a DB. On Page.Init you can deserialize the string and reset the old values to the respective Tabs/PageViews.

Regarding the issue with loosing the ComboBox values, I think you are using the right approach. Since (I suppose) the values are dynamically added to the ComboBox, and the ComboBoxes are dynamically created, you need to reset all values on every postback.

In general, when the controls (not just Telerik controls, but also standard ASP.NET controls) are dynamically created, you must take care of their state, and make sure they are created on every postback and the correct state is applied. For example you can create a custom class to save the state of every control, which will contain all the properties you want to save of the specific control, and methods for serialization, deserialization and application of the state.

PS. If you have questions for a different Telerik control, please open a forum thread (or support ticket) for the respective control, because this way when other people browse/search for solutions to their problem they will find the needed resources more easily.

Greetings,
Pero
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.
Tags
Dock
Asked by
Nag M
Top achievements
Rank 1
Answers by
Pero
Telerik team
Nag M
Top achievements
Rank 1
Share this question
or