views:

481

answers:

2

I need to load images after page load completed in ASP.Net without using JQuery.

Is it possible to implement this feature only using asp.Net 3.5 and ASP.Net AJAX? If it is then how to implement?

A: 

Override the OnPreRender() - method

JayJay
+1  A: 

JayJay assumes that you want to do it after the server side Page_Load event but befor page is sent to client.

If you mean after page is loaded on the client, then you can use this ASP.NET Ajax code: (It requires that you have a <asp:ScriptManager> on the page to enable AJAX)

<script type="text/javascript"> 
var prm = Sys.WebForms.PageRequestManager.getInstance();
if(prm) prm.add_pageLoaded( PageLoadedEventHandler );

function PageLoadedEventHandler() {
  // Do your stuff
}
</script>
awe
If there is a datalist containing images and I want to load those images after page is loaded on the client then how to implement this?
Himadri
If it is possible to implement this without using AJAX then please let me know.
Himadri
Where is the datalist (serverside code?) and what type? It would also help to see some of your existing code that is relevant to this.
awe
<asp:DataList ID="dlProductDetails" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" DataKeyField="ProductID" OnItemDataBound="dlProductDetails_ItemdataBound" OnItemCommand="dlProductDetails_ItemCommand"> <ItemTemplate> <asp:Image ID="Image1" border="0" runat="server" ImageUrl='<%#GetImageFullPath(DataBinder.Eval(Container.DataItem, "image")) %>' /> </ItemTemplate> </asp:DataList>There is a Datalist as above containing more than 50 images. I need all text contents of the page should be loaded first and as images are heavy so I need them to be loaded at the end. Plz hlp
Himadri