[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Mike Levin

8/5/2003 11:53:00 PM

Newbie question here.



I'm making a Web database application where I want to get the best
performance possible. I like the way Remote Scripting allows updating of the
dropdown menus without a page reload, and I would like to extensively do
that sort of thing, even for changing the SelectedIndex in a DataGrid. From
my research into ASP.NET, Web Services are the way to do this now, but I
can't find any examples of using Web Services specifically to update
elements on the page without page reloads. Anyone know any resources, or
willing to give some advice?

Mike Levin


2 Answers

Mike Levin

8/7/2003 1:49:00 AM

0

Hi Bjoern,



Thanks for the reply!



This article talks about migrating existing Remote Scripting code to .NET.
It appears to show how to swap out the old "after-page-load" communication
of Remote Scripting with a Web Service instead. This makes sense to me, but
what if I'm starting from scratch? Should I still use (and adapt) the old
Remote Scripting code for ASP.NET, or isn't there a cleaner way to do it
from scratch instead?



Here is some more background. I have enabled the keyboard arrow keys to move
the SelectedIndex on a DataGrid up and down while displaying a data table on
a Web page. While EXTREMELY cool, it causes a postback and visible page
reload. I'd like to speed this up. Is it possible to write a Web Service
that changes the SelectedIndex on an already displayed DataGrid, so Arrow
Key'ing up and down moves as fast as the local Client/browser can make it
happen? If I do that, is the internal record keeping happening so the
server-side knows it has a new SelectedIndex?



Should I start with the old Remote Scripting stuff as this article suggests?

"Bjoern Wolfgardt" <givenname.surname@removeme-cigate.de> wrote in message
news:eCLD66AXDHA.1896@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> maybe you would take a look at this:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting11...
>
> cu
> Bjoern Wolfgardt
>


Mike Levin

8/7/2003 1:07:00 PM

0

Hi Bjoern,

I'm reading the article. Interestingly, it says...
>the client HTML page does not need to be programmed using the .Net
framework.
I'm inclined to think the client HTML page cannot be programmed using the
..Net framework. I think I will investigate "record keeping" on the Client
Side, and pulling down the record keeping and syncing back up on the server
side on special events, like paging (versus just moving the highlight).

I'll look into the webservice.htc. I would consider implementing this
feature so you get blazing non-postback behavior on IE6, and slower but
equivalent behavior in IE5 & others. It's intended for an Extranet audience,
so I don't have control over user platform.

>I have never done what you want to do. How did you enable the key
navigation
>in the datagrid? ;-)

This won't work in when ASP.NET decides not to emit exactly the same
JavaScript links inside the Web Forms (I've got LOTS of experimenting to
do), but here's how I did it...

<script language="javascript" type="text/javascript">
<!--
document.onkeydown = function keyPress(evt)
{
var keyCode =
document.layers ? evt.which :
document.all ? event.keyCode :
document.getElementById ? evt.keyCode : 0;
if (keyCode == 38)
{__doPostBack('ArrowUp','')}
else if (keyCode == 40)
{__doPostBack('ArrowDown','')}
}
//-->
</script>

>But I don't think it will work what you try to reach.
>IMHO the problem you are facing is that if you "submit" the selectedindex
by
>webservice, the webserver doesn't have an instance of the datagrid :-(
>But another question. What will you do on the new selectedindex in your
>webapp???

OK, this is tricky. I'm still trying to figure it out myself. Currently,
when I move the SelectedIndex, I update a ViewState value containing the
primary key value so I have it available at all times -- but I probably
don't need that value until something special happens, like paging. If the
movement of the highlighter moves it to the next page, I do a paging event.
But the performance gain I'm trying to get right now is only for moving the
highligher within the same page. I could do this purely with JavaScript,
tweaking the Document Object, but then the server side is totally unaware of
what I've done. I was thinking about Web Services as a way of telling the
Server what I've done, so it can also update the SelectedIndex in its record
keeping. But perhaps the record keeping is only really done in the ViewState
object on the client, and I don't even need to communicate back to the
server (I don't know). Can I alter values in the ViewState object
client-side? Ugh! Everything is so new!

>Maybe another possible sollution is to disable the postback and only reload
>the page if something special happens on client side.

Yes, this is what I seem to be moving towards. I guess it becomes an issue
of doing "record keeping" client side (JavaScript variables?), and then pull
down the record keeping at special times and re-sync up on the server.

In an ideal world, I'd like ASP.NET to just automatically tweak the Document
Object Model when it can (moving the highlighter) instead of reloading the
entire page. It seems that since all the links it provides in Web Forms are
"javascript:", that it could be done. I'm investigating Web Services because
all Google research leads me to Web Services as an alternative to Remote
Scripting. But perhaps what I really need to research is general management
of values client-side and how to use them server side at special times.

Thanks again for the reply. Any additional feedback is appreciated!

Mike Levin

"Bjoern Wolfgardt" <givenname.surname@removeme-cigate.de> wrote in message
news:OwudtANXDHA.2256@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> The arcticle should only direct you to a point where you can start. It
> discusses the basic steps on how to access a WebService from HTML Client
and
> display the data without a reload of the page.
> You can alos take a look at this one:
> http://www.c-sharpcorner.com/Code/2002/May/HTMLClient4WebSe...
>
> If you will use only IE(6) I would use the webservice.htc. But I was not
> able to use it in other browsers. I also didn't find anything like the
> webservice.htc for other Browsers. So it depends on the client platform
you
> want to use.
>
> I have never done what you want to do. How did you enable the key
navigation
> in the datagrid? ;-)
> But I don't think it will work what you try to reach.
> IMHO the problem you are facing is that if you "submit" the selectedindex
by
> webservice, the webserver doesn't have an instance of the datagrid :-(
> But another question. What will you do on the new selectedindex in your
> webapp???
> Maybe another possible sollution is to disable the postback and only
reload
> the page if something special happens on client side.
>
> cu
> Bjoern Wolfgardt
>
>
>
> "Mike Levin" <Mike.Levin@Scala.com> schrieb im Newsbeitrag
> news:ez8QJYIXDHA.2464@TK2MSFTNGP09.phx.gbl...
> > Hi Bjoern,
> >
> >
> >
> > Thanks for the reply!
> >
> >
> >
> > This article talks about migrating existing Remote Scripting code to
..NET.
> > It appears to show how to swap out the old "after-page-load"
communication
> > of Remote Scripting with a Web Service instead. This makes sense to me,
> but
> > what if I'm starting from scratch? Should I still use (and adapt) the
old
> > Remote Scripting code for ASP.NET, or isn't there a cleaner way to do it
> > from scratch instead?
> >
> >
> >
> > Here is some more background. I have enabled the keyboard arrow keys to
> move
> > the SelectedIndex on a DataGrid up and down while displaying a data
table
> on
> > a Web page. While EXTREMELY cool, it causes a postback and visible page
> > reload. I'd like to speed this up. Is it possible to write a Web Service
> > that changes the SelectedIndex on an already displayed DataGrid, so
Arrow
> > Key'ing up and down moves as fast as the local Client/browser can make
it
> > happen? If I do that, is the internal record keeping happening so the
> > server-side knows it has a new SelectedIndex?
> >
> >
> >
> > Should I start with the old Remote Scripting stuff as this article
> suggests?
> >
> > "Bjoern Wolfgardt" <givenname.surname@removeme-cigate.de> wrote in
message
> > news:eCLD66AXDHA.1896@TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > >
> > > maybe you would take a look at this:
> > >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting11...
> > >
> > > cu
> > > Bjoern Wolfgardt
> > >
> >
> >
>
>