borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Datagrid column hide and show ?)Next Topic (From programmer prospect view, what is the difference between ASP application and Access application) New Topic New Poll Post Reply
AndreaVB Forum : ASP.Net : how to add column dynamically in datagrid ?
Poster Message
tri_inn
Level: Regular User
Registered: 26-08-2002
Posts: 395

icon how to add column dynamically in datagrid ?

say suppose i have one datagrid and after binding my datagrid i want to add a column dynamically in between other column.
is it possible if yes then please tell with sample code.

12-06-2004 at 08:05 AM
View Profile Send Email to User Show All Posts | Quote Reply
zimcoder
Level: VB Lord


Registered: 27-10-2003
Posts: 225
icon Re: how to add column dynamically in datagrid ?

Adding a column to a datagrid is not very complex.

First Create a new datacolum
DataColumn dc = new DataColumn("MyColumn",System.String);


You the add the column to your datagrid's column collection
MyDatagrid.Columns.Add(dc);
//Note MyDatagrid is the declared datagrid


You can add the column at a specific position
//This adds the column on the third slot in the datagrid's column collection
MyDatagrid.Columns.AddAt(2,dc);


hope this was helpful

[Edited by zimcoder on 30-07-2004 at 04:27 PM GMT]

____________________________
BrainBench ADO.NET and ASP.NET Certified Developer

30-07-2004 at 02:26 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : ASP.Net : how to add column dynamically in datagrid ?
Previous Topic (Datagrid column hide and show ?)Next Topic (From programmer prospect view, what is the difference between ASP application and Access application) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder