Last post Jan 20, 2017 05:30 PM by bruce (sqlwork.com)
Jan 19, 2017 08:21 AM|robby32|LINK
I have a Grid with a number of columns but in one particular column i use the following
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:Image ID="Image2" runat="server" ImageUrl='<%# ImageLink(
DataBinder.Eval(Container.DataItem, "DocNo"), DataBinder.Eval(Container.DataItem, "DocLineNo"),
DataBinder.Eval(Container.DataItem, "ImageId"))%>'>' Width="70" />
Now each line has a different image and if I have lets say 1000 rows to be rendered on the grid then this call is made 1000 times .
Is there a way I can use inline functions and avoid this much round trips to the server or is there a better way of doing this ?
Jan 19, 2017 10:50 AM|raju dasa|LINK
Enable paging for the grid instead of loading all records.
or, use defer logic, check this site:
or load on scroll:
Jan 20, 2017 07:33 AM|Eric Du|LINK
According to your description, as far as I know, you could use jQuery scroll and jQuery Ajax, loading part data every Ajax call! Here are two links about how to use Ajax call to load part data, please refer to these links:
Loading data in GridView while scrolling down in ASP.Net using jQuery AJAX:
Load data while Scrolling Page down with jQuery AJAX and ASP.Net:
Jan 20, 2017 05:30 PM|bruce (sqlwork.com)|LINK
you can inline the images using data urls. this will work if the images are small, but as base64 doubles the image size, your payload gets bigger. also there is no caching so if the image appears more than once is downloaded multiple times.