Javascript method for hiding datagrid rows?

R

Roy

Since a datagrid is just an html table anyways, this seems like it
should be easy but it's giving me a hard time. In ItemDataBound sub I'm
trying to kick off javascript code using response.write(). The
javascript code is contained within an IF block and if
e.Item.Cells(0).Text = myVariable then the row gets hidden.

A user can still view those rows later with a buttonclick.

Only problem is, I aside from what I've described above, I haven't the
foggiest notion of how to go about writing the javascript for this one.

Anyone have any ideas?
Thanks.
 
E

Eliyahu Goldin

That's a server-side task:

if e.Item.Cells(0).Text = myVariable
e.Item.CssClass = 'Invisible'

and somewhere in stylesheets set

..Invisible{display:none}

Eliyahu
 
R

Roy

Thanks for the info Eliyahu, it works great, but I was hoping to
develop a client-side way of hiding/revealing datagrid rows just
because I detest the "flicker" that occurs with a postback...
 
E

Eliyahu Goldin

You can do it easily on client-side. When I said it was a server-side task I
meant the first page load, not a postback. You can set className property of
the table rows on client side to "Invisible".

Eliyahu
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top