Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2007, 10:49 PM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to add a new column into gridview?

Hi everybody...
i'm the new guy here and also a new user for vb.net source code...
i want to ask about how to add a new and empty column to a gridview which can type the heading in a textbox and click a button to add the column in the runtime by using the vb.net source code?
Can anybody help me?

so far i have this code to view my data in the gridview:



        Dim ds As DataSet = New DataSet()
        Dim conn As OleDbConnection = New OleDbConnection

        Dim cmd As OleDbCommand = New OleDbCommand

        Dim DataAdapter As OleDbDataAdapter = New OleDbDataAdapter()

        conn.ConnectionString = ("Provider=microsoft.jet.oledb.4.0;data source = " & Server.MapPath("db1.mdb"))

        cmd.Connection = conn

        cmd.CommandText = "SELECT * FROM Stock"

        DataAdapter.SelectCommand = cmd
        DataAdapter.Fill(ds, "Stock")
        gv1.DataSource = ds
        gv1.DataBind()

        conn.Open()

        DataAdapter.Fill(ds, "Stock")


        gv1.DataSource = ds






Similar Threads
Thread Thread Starter Forum Replies Last Post
Add new subtotal column to GridView VB nomo ASP.NET 2.0 Basics 2 March 11th, 2014 01:36 AM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
VB.Net Gridview Column add and edit heading Bryan Stanley ASP.NET 2.0 Basics 2 August 26th, 2007 09:50 PM
Calculating Gridview Column Values rit01 ASP.NET 2.0 Professional 1 October 18th, 2006 03:46 PM
How to grab a column value from a GridView convergent7 ASP.NET 2.0 Basics 0 July 14th, 2006 12:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.