Hello,
I am building a module that displays dynamic data using an AjaxData:Gridview and a webservice call. When I have only one instance of the module on a tab, things are good. However, when I want to have 2 on the page, things breakdown. I've come at it a couple of different ways, but none seem to work.
The requirement is that each module will display data that is keyed to the module id. The web service takes the moduleid as a parameter and return an array of data that gets bound to the grid. This operation is done on a periodic (like every 10 seconds or so) basis.
The problem that I'm having is that the last module instance on the tab 'wins' when it comes to actually getting data.
I have something like this:
function pageLoad
{
window.setInterval(updateTime, 10000);
}
functiononLoadSuccess2(result)
{
GridView2.set_dataSource(UserInfo);
GridView2.dataBind();
}
function updateTime(sender) {
webservicecall( '<%=GridView2.ClientID %>', onLoadSuccess2);
}
There are a number of issues with the above, the bottom line is that it assumes that it's the only one on the given page.
In my dispair, I had (what I thought was) a good idea, to simply let the timer act as a singlton, pass the tabid to the web service, let the webservice build an array of responses (seems like a good idea, update all the grids with a single web service call!). then find the individual gridviews in the response and bind each one to the correct data. Seems like a good idea, but when you try to find the gridviews, you get back something else?
eg:
var ctlid = "dnn_ctr" + ModuleID + "_AjaxDemo_GridView2"
var gridctl = document.getElementById(ctlid).parentElement;
gridctl.set_dataSource(UserInfo);
gridctl.dataBind();
but the result of document.getElementById() is not something you can use to bind the data source to. (thows an exception, and inspecting the retuned object, would indicate that it's not the gridview, but the table(?!?!).
or am I just being dense and making things harder than they need to be?