Home All Groups Group Topic Archive Search About

GridView EnableSortingAndPagingCallBacks Select command.

Author
13 Nov 2006 9:05 PM
MikeS
Has anybody got a workaround for addding the equivalent of a select
command to a GridView that has EnableSortingAndPagingCallBack enabled
so I can get at the selected row?

Author
15 Nov 2006 5:14 AM
Brennan Stehling
This problem may not be solved in this way.  Instead look into the
UpdatePanel which is part of ASP.NET AJAX.  It will allow you to avoid
the full page refresh when you click the select button.

You can see it here...

http://ajax.asp.net/docs/mref/82a07319-001c-3fa5-43b7-74e9fc21f6f3.aspx

Basically you place the GridView into the UpdatePanel which uses a bit
of AJAX to change the GridView display.

You can find a video on it on the Get Started page here...

http://ajax.asp.net/Default.aspx

Brennan Stehling
http://brennan.offwhite.net/blog/

MikeS wrote:
Show quoteHide quote
> Has anybody got a workaround for addding the equivalent of a select
> command to a GridView that has EnableSortingAndPagingCallBack enabled
> so I can get at the selected row?
Author
15 Nov 2006 3:05 PM
MikeS
OK, Thank you. That is a good suggestion.

I have worked with the Atlas stuff but we can't use that in this
project in this iteration.
Author
15 Nov 2006 4:13 PM
Brennan Stehling
I do have another suggestion you could potentially use, but it is so
pretty or automatic.  Instead of using a Select button generated for
the GridView, you could simply place a market string into the column
where you want the button.  Then have Javascript loop over the rows in
the table and add buttons.  Normally when I have a button in a GridView
I set the CommandArgument value with the key for the row.  Hopefully
one of your other rows has the unique key you would need so that the
Javascript can use it to take action when the button is clicked.

Of course you will need to instrument each of the clickable elements
for the GridView like the sortable heading and pager links with a
Javascript event handler which causes the buttons to be redrawn when
the callback happens.

If you feel confident in your Javascript skills you could attempt this
approach.  But I personally would place it in risky category as you are
depending on a lot of things going just right.

Brennan Stehling
http://brennan.offwhite.net/blog/


MikeS wrote:
Show quoteHide quote
> OK, Thank you. That is a good suggestion.
>
> I have worked with the Atlas stuff but we can't use that in this
> project in this iteration.
Author
16 Nov 2006 2:25 AM
MikeS
Thank you, that is interesting stuff. I will look into it.

On the whole I guess a push for AJAX ASAP would be better than writing
a lot of wacky code  to solve a problem it solves.