Programatically hiding a row

R

Rohit Agarwal

Hi.

My question is how do I dynamically (onItemDataBound) hide complete rows in
a datagrid, which have null value in one of their cells.

If anybody can point me to some artical that would be a big help.

Thanks.
-
 
M

Marshal Antony

Rohit,
If you have a dataset ds,
put this code in the OnItemDataBound event :


for(int i=0;i<ds.Rows.Count-1;i++)

{

if(Convert.IsDBNull(((DataRowView) e.Item.DataItem)))
{

e.Item.Visible=false;

}

}



Hope this helps.

Regards,

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com
 
M

Marshal Antony

Oops!
use ds.Tables[0].Columns.Count instead of ds.Rows.Count which is wrong.
Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com

Marshal Antony said:
Rohit,
If you have a dataset ds,
put this code in the OnItemDataBound event :


for(int i=0;i<ds.Rows.Count-1;i++)

{

if(Convert.IsDBNull(((DataRowView) e.Item.DataItem)))
{

e.Item.Visible=false;

}

}



Hope this helps.

Regards,

Marshal Antony

.NET Developer

http://www.dotnetmarshal.com







Rohit Agarwal said:
Hi.

My question is how do I dynamically (onItemDataBound) hide complete rows in
a datagrid, which have null value in one of their cells.

If anybody can point me to some artical that would be a big help.

Thanks.
-
 
R

Rohit Agarwal

Thanks Marshal.
That worked.


Marshal Antony said:
Oops!
use ds.Tables[0].Columns.Count instead of ds.Rows.Count which is wrong.
Hope this helps.
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com

Marshal Antony said:
Rohit,
If you have a dataset ds,
put this code in the OnItemDataBound event :


for(int i=0;i<ds.Rows.Count-1;i++)

{

if(Convert.IsDBNull(((DataRowView) e.Item.DataItem)))
{

e.Item.Visible=false;

}

}



Hope this helps.

Regards,

Marshal Antony

.NET Developer

http://www.dotnetmarshal.com







Rohit Agarwal said:
Hi.

My question is how do I dynamically (onItemDataBound) hide complete
rows
in
a datagrid, which have null value in one of their cells.

If anybody can point me to some artical that would be a big help.

Thanks.
-

 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top