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','')}
}
//-->
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