|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Bug with new GridView object? Hidden column not workingIn .NET 1.0, I was a able to set a hidden column (usually for an internal ID) and be able to reference that column via code like this: e.Row.Cells(0).Text. The example below shows a datagrid that would be showing two columns and one of them would be hidden. <Columns> <asp:BoundField DataField="column1" HeaderText="column1" ItemStyle-Width="100px" ReadOnly="true" visible="false" /> <asp:BoundField DataField="column2" HeaderText="column2" ItemStyle-Width="100px" ReadOnly="true" /> <asp:BoundField DataField="column3" HeaderText="column3" ItemStyle-Width="100px" ReadOnly="true" /> </Columns> However, with .NET 2.0 e.Row.Cells(0).Text will ALWAYS return a blank value unless I make the field visible. Is this a bug in .NET 2.0? or have they come up with a new way of doing this? PLEASE HELP. Thanks, Evian This is the way it works now. If the field that you're hiding a primary
key, then you can add it to the DataKeys collection and access it through that instead. -- Show quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "Evian Spring" <evian_spr***@canada.com> wrote in message news:1139256545.945323.272870@o13g2000cwo.googlegroups.com... > Hi, > > In .NET 1.0, I was a able to set a hidden column (usually for an > internal ID) and be able to reference that column via code like this: > e.Row.Cells(0).Text. The example below shows a datagrid that would be > showing two columns and one of them would be hidden. > > > <Columns> > <asp:BoundField DataField="column1" > HeaderText="column1" ItemStyle-Width="100px" ReadOnly="true" > visible="false" /> > <asp:BoundField DataField="column2" > HeaderText="column2" ItemStyle-Width="100px" ReadOnly="true" /> > <asp:BoundField DataField="column3" > HeaderText="column3" ItemStyle-Width="100px" ReadOnly="true" /> > > > </Columns> > > > However, with .NET 2.0 e.Row.Cells(0).Text will ALWAYS return a blank > value unless I make the field visible. > > > Is this a bug in .NET 2.0? or have they come up with a new way of > doing this? > > PLEASE HELP. > > Thanks, > Evian > |
|||||||||||||||||||||||