Reputation:
I've created a Windows Forms Application in C# which allows users to add controls to a TabPage which they can resize and reposition. Now I want to do the same thing only in ASP.NET.
I managed to add the controls dynamically following this tutorial. I use jQuery UI to make them resizable and draggable. The problem I encountered is that when I add a new control all the others are reverted to their initial position and dimension.
I assume I have to save their position and size and apply them to the newly created control on LoadViewState. Is there a way I can view this attributes from code-behind? I've managed to get these info using Javascript but I don't know how to get it into code-behind.
Can someone please point me in the right direction? Thanks in advance.
[EDIT] Thank you for your answers. Here's the code: HTML C#
Upvotes: 3
Views: 572
Reputation: 25694
You need to store the positions and dimensions of the controls and pass those values to the server when you click the add control button.
You have a few options of how to do this.
<input type="hidden">
)style="display: none;"
)You can use JavaScript to set these values, then apply the positions in your code behind after adding a new control.
Upvotes: 1