Showing posts with label loaded. Show all posts
Showing posts with label loaded. Show all posts

Saturday, March 24, 2012

Load an script at first.

The scriptmanager will Load the script at last (when all of page loaded).

How to load the script at first (before all object of this page) as this page do:

http://www.pageflakes.com/

Thanks for reply!

(Sorry because my English)

hello.

have you tried using the registerclientscriptblock method?


uh!, Thanks your suggest from you, I will try it. Thanks.

Load content on demand or in portions

Hi,

I have large chunks of text (400-500Kb) that are loaded inside update panel when user clicks on a tree node with the book name. It works fine and all. The only thing is that the text is first downloaded to client and then shown - the user will have to wait for the whole 400Kb of text to download. Is there a way to show the first 5-10Kb of text once it has reached the client and keep loading the reast while user is reading?

And one more question - is this ok that Page_Load() event is fired every time UpdatePanel is updated?

Hi abolotnov,

To start with your last question it is normal that the page_load event get fired when you are doing a partial update. The trick is within the rendering of the HTML, so thats correct. What kind of control is inside your UpdatePanel (treeview?) You can use a updateprogress control to make clear to the user that the page is still updating. Can you past some code here so we can analyze your code. Thanks

Regards,


yeah, I know I can use UpdateProgress control to tell the user that the page is still updating... this is not I really want though -

say I have this UpdatePanel with DIV inside of it and need the text in DIV to be updated. The text is 400K - quite a lot for people with slow internet connection (dialup for example). I want them to be able to start reading the text before it's downloaded in whole. Say, if their connection speed is 4K/sec, they will be able to start reading in 1 second - 4K of text gives them enough to read before the rest is downloaded - another 4k will come next second etc.

What I have now is when the update starts use sees this message "content for reading pane is being updated, please wait" untill the whole portion of text is downloaded and then rendered. For people on slow internet connections it takes quite a while 400/4 secs.


Don't ask me why I can't split the text into smaller portions and allow users to page through the text - I will if there is no way to sort out what I want.

Thanks for any comments you may have on this.

Wednesday, March 21, 2012

Loading asynchroneously a webcontent from a menu

Hi

I have a menu on a masterpage. I would like the webcontent asynchroneously loaded when I click on the menu

I placed anUpdatePanel on theWebContent and a trigger targeted on the Menu.MenuItemClick event.

This is the test code:

protectedoverridevoid OnPreInit(EventArgs e)

{

base.OnPreInit(e);MasterPage Master =this.MasterasMasterPage;

Microsoft.Web.UI.AsyncPostBackTrigger trigger =newAsyncPostBackTrigger();

trigger.ControlID = Master.MyMenuID;// get Menu.ID

trigger.EventName ="MenuItemClick";

this.UpdatePanel1.Triggers.Add(trigger);

}

But this does not work at all.

Is there any way to do this?

thank you

Hi,

Please refer to this documentation:

http://ajax.asp.net/docs/mref/T_System_Web_UI_AsyncPostBackTrigger.aspx

Programmatically adding AsyncPostBackTrigger controls is not supported. Use the RegisterAsyncPostBackControl(Control) method of the ScriptManager control to programmatically register a postback control, and then call the Update() method of the UpdatePanel when the control posts back.

Hope this helps.

loading web user controls asynchronously

I am new to asp.net ajax. I want to load multiple web user controls in a aspx page independently after the page has been loaded so that user will know that something is happening in the page rather than showing them blank screen. IS there a way to do it using Ajax or is it not possible to do so?

any help would be appreciated

You could have update panel for each user control that have a timer set as their trigger. When the timer elapses, load the user control you want into each update panel. use an update animation in each to let the user know something is happening.


This seems a bit backwards. UserControls become a part of the page itself, so delaying their "loading" isn't likely to help you. If you want to show some sort of progress or other indicator to the user while the page is processing, you can do that with an animated gif or with Remote Scripting ("AJAX").


how can i achieve remote scripting using asp.net ajax. The problem is i have couple user controls that runs heavily in database and it takes about 5 seconds to finish. I want to display the remaining content in the page while the user control is loading.

please help.


hello.

well, the only option i see is to laod the page without that content and then call a web service from the client side that gets the data from the server and presents them to the user. you should keep in mind that an asp.net page generates html that is sent back to the client. this means that you cannot sent the page to the client with "wholes" that will be filled up later...it simply doesn't work like that!


It's true you can't leave holes in the HTML, but that doesn't mean you need load everything at one time.

If you modify your user control to not load the data that takes five minutes on page load, but only to load it when a certain method is run you can load the user controls in the update panels as I suggest above and then you can trigger the data to be loaded into it via a timer, or a java script function that runs when the page loads in the client's browser.


hello again.

true, but in those cases, why not simply call a web service and then use js to update the ui without incurring in another partial postback?


If you do that can you use the updatePanel animation to notify the user that something is happening or do you have do it manually with js?


hello.

well, the updateprogress is really a wrapper around client behavior that is responsible for showing/hiding the contents you define. the upadteprogress is "tied up" with the partial postback model based on the server side approach.

nothing prevents you from doing something like this is js:

1. define the wait msg in an html element that has its display style set to no none

2. start the web service call and change the display of the element defined on 1

~3. handle the cb and error cb methods and make sure that you set the style of the element defined on 1 to none

yes, you do have to write some js code, but when you think about it, the J in AJAX stands for Javascript, right? :)


i am thinking to call the update panel after onload event using javascript. is there any idea how to call update panel using javascript.


hello.

well, the easiest way i've seen is to call __doPostBack and pass it the client id of the panel you want to update:

http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/


I just came accross a post where xr280xr says he acomplished exactly what you're trying to do using a timer.http://forums.asp.net/t/1176152.aspx


well, i'm sure that the timer has its uses, but if you just want to refresh the panel after the page has been loaded through js code, the link i've mentioned is the best option.


I'm happy to defer to your increased experience and knowledge on this, but can you explain why it would be preferable to go through the hassle of manually writing a JS function to do it as opposed to just using the timer as described in that post. I truly don't mean this in a rude way; I just don't see the benefit. Could you explain?


Luis,the link you provided is not working. would you please provide again.