Need a technique to speed up processing

  • Thread starter Thread starter dang57
  • Start date Start date
D

dang57

I had written a vb.net app for clients that wanted to use a datagrid
like a spreadsheet. Rather than edit one line at a time, they wanted
all lines available at all times. That seemed to work fine, except
now there is a response-time issue when there are many lines in the
grid. The viewstate is getting very large.

There are close to 50 input fields on each row, and some folks are
adding upwards of 50 rows or more. The real issue is that as values
are entered in a few specific columns, I need the app to jump back
over to the server, validate the input, and possibly pre-fill a few
other values in that row. As the grid gets larger, changing a value
and making a round trip to the server can take 15-20 seconds. And
validation must take place on the server, because I have to hit the
database. I would have preferred to bury the validation tables in the
screen, but they're way too large.

I'm using Anthem keep from having to refresh the entire screen all the
time, and that helps keep the screen from jumping around. But what I
really need is a way to send to the server only a few fields rather
than the entire viewstate. It has to be flexible, though. When I'm
validating those specific fields, I want only those fields sent to the
server. But if they click the Save button, all of it needs to go.

I've made some tests using Anthem.InvokePageMethod and
Anthem.InvokeControlMethod, but they still run slow. They seem to
call the routine I want, but that's after the entire viewstate is sent
in. I've tried EnableCallBack on Anthem fields, but it seems like
that's something that needs to be defined before the screen is
painted. Since I don't know if they're going to enter a value or
click Save, I don't know which fields to set up for EnableCallBack.
If I do that for the entire grid, they all get returned, and I haven't
gained anything.

I've considered setting up another class to receive a message, but
that would have to open another window, wouldn't it?

What I really want is a way to send a few fields to the server, which
in response, will set a few other fields within the grid. Seems to me
that there must be a way to do that, but after two days of searching,
I've yet to find it. I need a clue.

Thanks for any suggestions.
Dan
 
What about calling a web service from the aspx page, the client script would
be responsible for populating any fields etc, but it would mean you're not
posting back all the time.

You can also lessen the amount of data being sent to the page by storing the
viewstate in your DB.
 
Thanks for the suggestion, Adrain.

I'm trying to get it working with a web service. So far, it doesn't
work, but I think a solution is in there somewhere. Unfortunately, I
don't quite know what the exact parameters should be, so it's a bit of
hit and miss. (mostly miss)

In the code (below), it always falls into the "readyState == 4"
condition.
I can see in the alert text that it's trying to run "Howdy.asmx?
op=HelloWorld", which is hopefully correct. I have tried calling it
from the codebehind, and it works, so I'm pretty sure the asmx is
fine. I don't want to leave it in the codebehind, because it has to
load the viewstate to get in there. Running directly from the
javascript seems like the way to go.

If you spot something wrong in the code, or if there is a better
technique, please let me know.

var soapHeader = '<?xml version="1.0" encoding="utf-8"?>'
soapHeader += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
soapHeader += '<soap:Body><HelloWorld /></soap:Body></soap:Envelope>'
var postUrl = 'Howdy.asmx';
var soapActionUrl = 'HelloWorld';

xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
xmlHTTP.open ('GET', postUrl, true);
xmlHTTP.onreadystatechange = function() { if ( xmlHTTP.readyState ==
4 ) { alert(xmlHTTP.responseText); } };
xmlHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHTTP.setRequestHeader("Host", "localhost");
xmlHTTP.setRequestHeader("SOAPAction", soapActionUrl);
xmlHTTP.setRequestHeader("Content-Length", soapHeader.length );
xmlHTTP.send(soapHeader);

Thanks again
Dan
 
Well, I'm still struggling with this.

The article seems to expect AJAX, but we're not using that. We have
Anthem controls. Also, I have a feeling that this might only work
with .Net 2.0, but we're still at 1.1.

Per the article, I tried adding <asp:ScriptManager>, but it's not
recognized by the forms designer. When I don't use the ScriptManager
block, the Javascript fails looking for the <namespace>.Howdy. One
post indicated that something needed to be added to the web.config,
but everything I try adding gets execution errors. Perhaps the blocks
don't apply to 1.1.

According to the Microsoft knowledgebase, webservices can be used with
1.1, but I can't find any examples of non-AJAX, non-SOAP webservice
calls from javascript.

I'll keep looking...

Thanks
Dan
 
I found (what appears to be) a very useful page: http://www.15seconds.com/issue/040708.htm

It has walked me through setting up <div id="service" style="BEHAVIOR:
url(webservice.htc)" onresult="DisplayResults()"></div> and
useService / callService commands. I think it's almost there, except
that the actual call returns "fault string = service unavailable".

Now trying to figure out why the service is unavailable...

(heavy sigh)

Dan
 
Back
Top