- Create Account

Target to a ContentPlaceHolder???

Forums > DragResize > Target to a ContentPlaceHolder???
Author
Message

1) KennyBoy Group: Guests
IP: 85.82.--.--
First of all, what a TOTALLY AWASOME SCRIPT!!!!!!!
Be very proud!, this is a very good job!!! :)

I  am studying writing my final examen in computer science.(be handed over 13 april).
I am in a bit of haste. I am trying to create multiple dragresize from a button control in a AJAX Tab Control(ASCX). So fare it works fine, though it is add in the

document.body.InnerHTML  += NewElement(txt, t, l, w, h).

Is there a way to target a ContentPlaceHolder instead of body.innerHTML?

I have only had 1 days introductionary course in school about javascript.
Furthermore, I also would like to store the position of these to a database.

Is there any guide you could recommend upon this subject?
I am experineced in SQL 2005 Express and C#, just not Javasccript

Again i would like to congratulate for this very cool piece code - and sorry to disturb you.




2) KennyBoy Group: Guests
IP: 85.82.--.--
So sorry, my english is not so good. hope you understand my question :)

3) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
Try using document.getElementById('element-id') to get a reference to a particular placeholder then create your new draggable elements within that.

Also, "innerHTML  += xyz" is a little broken and slow sometimes as it means the entire content of the element is reset. Try creating a new element (document.createElement), appendChild() that onto your container element, then create its contents (innerHTML if you want to is OK there).

- Angus.

4) KennyBoy Group: Guests
IP: 85.82.--.--
Thank you so much for the advise!:) I will try this.

5) KennyBoy Group: Guests
IP: 85.82.--.--
Sorry interupt again, but i have one more question.

function addContainer()  
   {
          var  container = document.createElement('div');
          var  dragBox = document.createElement('div');
          dragBox.className = "drsMoveHandle";
          dragBox.style.background  = "red";
          dragBox.style.height = "20px";
          dragBox.style.width  = "100%";
          container.appendChild(dragBox);
          container.className  = "drsElement";
          container.style.background = "white";
          container.style.height  = "100px";
          container.style.width ="200px";
          container.style.top  = "75px";
          container.style.left = "205px";
          container.style.border  = "1px";
          var contHolder = document.getElementById('ctl00_ContentPlaceHolder1_frame');
          contHolder.appendChild(container);
          dragresize.apply(contHolder);  
    }

This  seemes to work fine, draging, resizing and creation.
But when i view the source of the my default.master in my browser, the created elements dont show. will this not give me problems when i want to save these and their position to my database? I want to use these to create layouts for my webpages.

6) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
Try something that will view the live DOM source like http://www.getfirebug.com for Firefox.

In short: you'll need to implement a script that finds all your elements and remembers their positions then populates a form field to POST back to the server. That's probably the easiest way. And it will work OK with your current approach.

- Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.