-
Datagrid dispaly
I have 2 comboboxes(outside of datagrid) and 1 datagrid.Based on the two combobox selections,the selected items on both should display in a single datagrid.
My problem is when i select the first combobox item,it displays properly on the datagrid.when i select the second combobox item it should append in the datagrid.instead it replaces the first column.even if i select the other columns in the first combobox it should also append not replace.
How do you display more than one column from the same combobox in a datagrid
Regs
Seetal
-
I assume that the DataGrid is bound to a dataset of some kind, correct? If so, you should create a single dataset based on the selections in the two combo boxes, then bind the dataset to the grid.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Datagrid Display
I have not yet connected to the database.I need the selected items from combobox to display in datagrid as a column header .
-
OK. Please post the code you're using to assign the combobox values to the datagrid. Thanks!
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Datagrid Display
Private Sub UiCboClient_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UiCboClient.SelectedIndexChanged
Dim mytable As DataTable
myTable = New DataTable("Client_Details")
myTable.Columns.Add(New DataColumn(UiCboClient.Text, GetType(String)))
Me.GrdBusiness.SetDataBinding(myTable, "")
Me.GrdBusiness.RetrieveStructure()
End Sub
-
OK. You're binding the DataGrid to a DataTable (myTable) containing the column headings, but you're creating a new DataTable each time the user selects an item from a combobox, so your DataGrid will only ever have a single column heading.
Try this: Declare myTable at the Class level, rather than inside a Sub or Function:
Dim mytable As New DataTable("Client_Details")
Then, in the SelectedIndexChanged event, do this:
myTable.Columns.Add(New DataColumn(UiCboClient.Text, GetType(String)))
Me.GrdBusiness.SetDataBinding(myTable, "")
Me.GrdBusiness.RetrieveStructure()
That will add a column to the DataTable without recreating it each time.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Datagrid Display
Thanks A lot Phil.
It works Great.I Appreciate.
Similar Threads
-
By software_develo in forum .NET
Replies: 4
Last Post: 01-17-2009, 07:17 AM
-
By naijacoder in forum ASP.NET
Replies: 0
Last Post: 09-02-2005, 07:28 PM
-
By Webmaster in forum dotnet.announcements
Replies: 0
Last Post: 06-05-2003, 09:30 PM
-
By Thomas Eyde in forum .NET
Replies: 8
Last Post: 08-01-2002, 06:43 PM
-
Replies: 2
Last Post: 08-01-2002, 10:54 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks