DataGrid - Disallow Postback?

R

Rich Wallace

Hi all,

Is there a way I can design the datagrid where, if the SelectedIndex changes
and I highlight the selected row, that the grid does not re-write itself and
keep the current page smooth, or avoid the 'flash' of the re-write?

TIA
-Rich
 
J

John Saunders

Rich Wallace said:
Hi all,

Is there a way I can design the datagrid where, if the SelectedIndex changes
and I highlight the selected row, that the grid does not re-write itself and
keep the current page smooth, or avoid the 'flash' of the re-write?

You could use your own "select" button in a TemplateColumn. That button
could do the highlight client-side. I'm not sure how it would be able to
fake the SelectedIndex change, though. Do you want the server to eventually
find out about which row is selected? If you don't care, then just changing
the highlight client-side might be enough. Otherwise, you'll have a problem
because I believe that SelectedIndex comes from the Select button being
clicked (and posting back).
 
R

Rich Wallace

Thanks John,

I will need to know the SelectedIndex value when the user selects a row.
Just playing with the idea to see if I could make the app a bit smoother by
disallowing the refresh.

Thanks again.
-r
 
S

S. Justin Gengo

Rich,

If you turn on smart navigation (page property SmartNavigation = True) that
will have the effect you want.

But smart navigation can be a bit flaky. I've found that it sometimes causes
problems, but whenever I've used it and it caused a result I didn't like say
with a response.redirect I have just turned it off before running the code
that conflicts with it.

So, for example, if having smart navigation turned on stopped a page from
redirecting properly I just turn it off: Page.SmartNavigation = False and
then do the redirect.



--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
J

John Saunders

Rich Wallace said:
Thanks John,

I will need to know the SelectedIndex value when the user selects a row.
Just playing with the idea to see if I could make the app a bit smoother by
disallowing the refresh.

Ok, I guess I'm confused, then.

If you want the user to click the Select button, then later you want the
server to know which row was selected (i.e., which Select button was
clicked), then you're going to have to post back.
 
R

Rich Wallace

OK, I just wasn't sure since I only need to know which one is selected at a
certain point. In other words, when teh grid is loaded, the user has the
ability to click on a row to highlight it, but I won't need the server to
know what row is selected until the user clicks on a certain button.
 
J

John Saunders

Ok, this works. Just do your Select client-side, as I said originally. When
this other button is clicked, the form will post back. Your client-side
Select javascript will have to save the selected row number somewhere,
perhaps in a hidden field. On the server, you'll be able to get the value
from the hidden field to see which row was selected.
 
R

Rich Wallace

Got it, worked like a charm, thank you sir!

John Saunders said:
Ok, this works. Just do your Select client-side, as I said originally. When
this other button is clicked, the form will post back. Your client-side
Select javascript will have to save the selected row number somewhere,
perhaps in a hidden field. On the server, you'll be able to get the value
from the hidden field to see which row was selected.
--
John Saunders
johnwsaundersiii at hotmail


Rich Wallace said:
OK, I just wasn't sure since I only need to know which one is selected
at
a
certain point. In other words, when teh grid is loaded, the user has the
ability to click on a row to highlight it, but I won't need the server to
know what row is selected until the user clicks on a certain button.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top