Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web datagrid with dynamic grid columns (AutoGenerateColumns="true") using Infragetics 4.5 .

also I want to hide/shoe dynamic columns based on condition.

The below line is used to change column width
GRidName.Rows[0].Items[2].Column.Width = new Unit(25, UnitType.Percentage);

It is working fine but when grid datasouce has more than one records.

Issue:

when grid datasource has no records then I am getting 'Gridname.Rows[0] is null' error.


Please guide me if anyone knows about that issue.
Posted

1 solution

You can use column(Index).hide property or check if your datatable has rows

If Gridname.rows.count > 0 then
gridname.rows[0]...
End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900