DataGrid Columns

tinkert

New Member
I have VB.NET, and I like many of the GUI features. I am trying to manually create columns for a DataGrid (autogeneratecolumns = "false") and see two techniques, but not the one I was hoping for:<BR><BR>I see a GUI technique, by right clicking on the DataGrid control and setting properties ... I don't favor this?<BR><BR>I have sucessfully altered the HTML view by adding the <Columns> tags and filling them accordingly. I don't favor this, but it's ok?<BR><BR>I was hoping for a means of editing a DataGrid Columns collection in VB code. I don't see this? <BR><BR>IS THIS POSSIBLE?It's possible, but trust me, you don't want to do it. To see the complexity of the code needed to generate the special datagrid columns, create a very simple ASP.NET Web page that does nothing but bind an array (or DataReader or whatever) to a DataGrid that has some custom columns set using <Columns>. Then, introduce a run-time error (by adding something like: Dim x as int in your server-side code (assuming you are NOT using code-behind)). When you view the ASP.NET Web page you will get an error (int not defined) and you can click on a link to see the complete source code. It's VERY ugly.<BR><BR>So stick with the <Columns> approach, IMO it's the best bet.
 
Back
Top