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

How to use the same control

4 Answers 60 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Andy Ho
Top achievements
Rank 1
Andy Ho asked on 26 Jul 2010, 09:14 AM
I have created 2 docks which load the same .ascx file.

In the .ascx, there is a button to set the object "tblInput" visible (a table object). But when I click the button on the second dock, the table in the first dock make visible. How to prevent this?

4 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 28 Jul 2010, 04:46 PM
Hello Andy,

I suppose you are making the table visible with some JavaScript function, and this function resides in the user control. If this is the case, when the user control is added to the same page more than once the same JavaScript function will be added to the page more than once, so the previous definition of the function will be overridden by the last definition. To show this please click the "Alert" button on both docks, and one and the same value will be alerted, when in fact they should be different.
You can avoid this from happening by dynamically registering the client script from the server. I have implemented this approach in the attached project.

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
Andy Ho
Top achievements
Rank 1
answered on 29 Jul 2010, 01:20 AM
First of all, thanks for your reply.

I'm not using Javascript to do so, I use server side to make it visible:

tblInput.visible=true

I use RadContextMenu, right click "Edit" and then show the Edit table.

0
Accepted
Pero
Telerik team
answered on 02 Aug 2010, 08:42 AM
Hi Andy,

I modified the project from my previous reply to show/hide the <div/> on the server side, using the Visible property, and everything seems to be working fine. The modified code is attached to the thread.
I am not sure what might be causing the issue on your side, so please give us more information about the problem. A sample project that demonstrates the issues will help us a lot in finding and providing a working solution.


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
Andy Ho
Top achievements
Rank 1
answered on 03 Aug 2010, 02:08 AM
Pero,

Thanks for your reply. Your solution works ok! I've checked the problem exists because I used a GUID as the Dock's ID.

Andy
Tags
Dock
Asked by
Andy Ho
Top achievements
Rank 1
Answers by
Pero
Telerik team
Andy Ho
Top achievements
Rank 1
Share this question
or