473,320 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Javascript method for hiding datagrid rows?

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.

Nov 19 '05 #1
6 1976
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

"Roy" <ro**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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.

Nov 19 '05 #2
I would usually hide rows on a datagrid when they were children of a parent
record. I have a sample with the source code for such a datagrid:
http://www.societopia.net/samples/webform2.aspx
---

"Roy" wrote:
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.

Nov 19 '05 #3
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...

Nov 19 '05 #4
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

"Roy" <ro**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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...

Nov 19 '05 #5
Roy
Beautiful!
Thanks my friend!

Nov 19 '05 #6
Roy
Awesome, thanks for the link socie!

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
2
by: Tim::.. | last post by:
Hi I'm trying to create a little application that shows an image of a user when you mouseover there details in a datagrid. The datagrid is populated from an Active Directory Database and I...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
13
by: Liz | last post by:
Do you really have to use these methods like RegisterClientScriptBlock() to get client-side Javascript into an ASP.NET 2.0 page ? For anything beyond trivial scripting, this is really a painful...
5
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove...
5
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.