I have an item with a html
for example…. <img id=”img1″ src=”/icon.png”></img>
I’m trying to modify this image dinammically… but..
When I try
The img1 is not found.
I need to modify the image src for example:
document.getElementById(“img1”).src = “/icon2.png”
Yes you can but on the server side. The data is always coming from the server. The data reader on the client loads only the data pages that are needed for rendering and discards the rest. If you have 500 items (or rows) of data, the client only requests 20 or 30 (depending on the size of the scrollable area). As you scroll, the client asks for more and discards the blocks that are not needed according to memory needs.
You can use Eval(“document.getElementById(‘icon1’).src=’…'”) and “icon1” is an element in a cell it works perfectly well but only if the cell is rendered and the html actually exists. On the server side, you can change it an any time, the server will issue a refresh command to the client and the client will reload the visible range.
If you give a description of the requirement we can try to come up with another solution.
Can I modify the cached data?
in addition to my previous reply, we also need to know the sequence of your calls, i.e.
when does the code on the client needs to be executed.
on the browser since the listview (and datagridview) uses a cached virtual data store ajax systemto retrieve the items/rows as you scroll.
So please give us some more information to determine wether the item could still be outside the scrollable area
or waiting for the servers pull request when your code is called.
Thanks in advance,
please try following the tips Luca has provided here:
If it does not work, please provide us with a small sample.
Thanks in advance !
Please login first to submit.