Showing posts with label mind. Show all posts
Showing posts with label mind. Show all posts

Wednesday, March 28, 2012

Programmatically add an Extender

I'm a huge newbie when it comes down to AJAX, ASP.NET and some more of the good stuff. I hope you don't mind me sticking around here ...

I've been playing around with de CustomDragDrop library provided by Omar Al Zabir. (http://www.codeproject.com/Ajax/MakingGoogleIG.asp)
I added some transparency while dragging and the ability to call a WebService or a WebMethod (on the Page) .

I've got a static example with a few div's which are draggable into other div's, registered as dropzone's.

Now, I want to makes this useable!
I've created a DataList and I want to programmaticaly add CustomFloatingBehavior to each DataListItem.
So in the event OnItemCreated, I make a new CustomFloatingBehaviorExtender and provide the necessary properties.
Finally I put my extender in the UpdatePanel and Update it.


There's just one thing I can't figure out ...
In the static version each draggable item has JS init handler looking like this:
Sys.Application.add_init(function() {
$create(CustomDragDrop.CustomFloatingBehavior, {"DragHandleID":"DragHandle","id":"WidgetFloatingBehavior"}, null, null, $get("DragItem"));
});


My dynamic version doesn't work yet, and it think the problem might be the above lines.
I should be able to programmatically add these for each DataListItem aswell.
Has anyone got anay suggestions?

Thanks in advance!

You'll find that dragdrop stuff is currently pretty poorly supported and you might be better off rolling your own.

Personally, I do drag-drop entirely on the client side (via $create(Sys.Preview.UI.FloatingBehavior...etc) calls), and I avoid UpdatePanels like the plague. As such, I'm not as clear on the UpdatePanel lifecycle and events as I should be to answer your question, but I suspect that the clientside init event is not fired by the updatepanel on partial postback. Consider isntead looking athttp://ajax.asp.net/docs/overview/PartialPageRenderingOverview.aspx and see if you can use that pagerequestmanage.add_pageLoaded() function (or one of the other member functions) to fire off a custom javascript that runs the $create() script on new draggable items.

Wednesday, March 21, 2012

Question Loading Page

Hi! I have a thing in mind for my page, but can't see to figure it how can I do it, so if someone have done these, please let me know!!!

I want when loading the page, instead of waiting for everything to load, to show something saying... The page is Loading, please wait.

Like the Live messenger when it's loading, it has the message "Loading page" and just displays that, when the page is full loaded then it is shown...

Can someone help me with these?

thank you

Hi HoLLoW,

You can try starting with my example here:http://forums.asp.net/thread/1622218.aspx

It's not exactly what you need, but all you would have to do is add in your DIV that contains your loading message and have the style set to visibility:visible. In the onload event of the BODY tag you simply need to set visibility:hidden on your loading message and then unhide your content.

You could also try using the AlwaysVisibleControl (for your loading message DIV) from the AJAX Toolkit so if a user scrolls down the page they will still see your loading message.
http://ajax.asp.net/ajaxtoolkit/AlwaysVisibleControl/AlwaysVisibleControl.aspx

As soon as the page is finished loading, the BODY onload event script is executed, and your visibility settings are set.

Cheers,
Al