GridView EnableSortingAndPagingCallBacks Select command.

M

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?
 
B

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/
 
M

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.
 
B

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/
 
M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top