.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT
Post New Web Links

How to fill different ComboBoxes in a DataGridView control with C#?

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Windows Application
I have a datagridview with 3 comboboxes.
When in combobox 1 (=Rownumber = 1) AA is selected then at runtime combobox2 has to be filed with some value. 
This value is comming from a DataTable.
When some value is selected in combobox2 (Also RowNumber = 1), then at runtime combobox3 (also RowNumber = 1) has to be filled with some value also comming from a DataTable.

Above means that when combobox1 where the columnindex is 0 has the value:

When AA is selected ComboBox2 where the columnindex is 0 must have the value (ComboBox2 is must be filled at runtime and the values are comming from a DataTable):

When 11 is selected ComboBox3 where the columnindex is 0 must have the value (ComboBox3 is must be filled at runtime and the values are comming from a DataTable):


At RowNumber 2 ComboBox1 has the value:

when BB is selected, ComboBox2 also at RowNumber 2 must have the value (ComboBox2 is must be filled at runtime and the values are comming from a DataTable):

View Complete Post

More Related Resource Links

Fill dockpanel with child control


Hi, I have a win forms program which I am trying to write in WPF. I have a DockPanel which is 800x600, and inside that I want to add 1 child control at a time to fill the available space. In winforms this worked by just setting the item to Dock fill. I have set the dockPanel to LastChildFill, the problem is the child control I am trying to add is 400x300. In Winforms this was automatically increased to 800x600, and this is what I am trying to achieve with the dockPanel, but I am not sure how.

If I remove the height and width that are set in the control, then this does fill as expected. So is there anyway to get the dockpanel to override the child controls size, and make sure it fills the available area?

how to fill user control(.ascx) (Dropdown from Database)


i am created a user control(.ascx)

<span><asp:DropDownList ID="Drop_DocType" runat="server"  DataTextField="DOCTYPE"DataValueField="DOCTYPE"/></span>

  how to fill it rom database and where i put soure code

how to create dropdownlist user control(acsx) and fill from database


how to create dropdownlist user control(acsx) and fill from database

How can I fill a Combobox in a datagridview? C#


I have made by code a datagridview. This datagridview has several comboboxes.

I want to populate this comboboxes at runtime. But I don't know how.

The code I tried:

NaardataGridView2.CurrentCell.Value = getKolommen(selVanTabellen);


getKolommen give a datatable with names. The above code doesn't work. I want something like:

NaardataGridView2.CurrentCell.DataSource = getKolommen(selVanTabellen);


Can some one help me?


Merge ColumnHeader Cells of DataGridView Control.




I Want To Merge ColumnHeader Cells of DataGridView Control.

I would Like Draw a Rectange in such a way tha From Sixth Column Header to 9th Column

kindly Reply Regarding this Topic


Lakshman C B


Datagridview control vb.net Windows Form

I want to detect the keystroke or keycode for the "Arrow Up" Or "Arrow Down" in the Datagridview "Selection Changed" event on a vb.net Windows form. Just to want to put a "If" statement to do some stuff if it is true that the keypressargs is either "Arrow Up" or "Arrow Down". Thanks

Row provided does not belong to this DataGridView control. Parameter name: dataGridViewRow


I am trying to delete a Multiple rows from database through datagridview. some more information about coding is "data as Dataset" & "adap as TableAdapter" & "Group is my Table Name". I am using Visual Basic 2008 express edition with sql server 2008 Express Edition with Management Studio. I created the .mdf file in Mangement studio and i connected this file directly to the project. My opreating System is WINxp Proffessional. Now my code is given below:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each Row As DataGridViewRow In GroupDataGridView.SelectedRows



  End Sub

while using this code i can delete only one row but when i am trying to delete 2 to 3 rows on one time then it shows me this error Row provided does not belong to this DataGridView control. Parameter name: dataGridViewRow.

My virtual mode is on False

How to resolve this problem please help me out


Naveesh Gupta



Presenting Data with the DataGridView Control in .NET 2.0 > Defining Custom Column and Cell

in this link u can find the explanation about how to bind image column at run time.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

In-Depth look at the GridView Control

In the last article we looked at few of the new controls available in Asp.net 2.0. We also talked about Grid View Control which has replaced the Asp.net 1.1 DataGrid control for good. In this article we will examine more features of the Grid View control. In this article we will see some of the common operations that can be performed using the GridView control. Apart from these operations there are many more functions that can be performed on the control and which we will see in the later articles

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Using TemplateFields in the GridView Control

The GridView is composed of a set of fields that indicate what properties from the DataSource are to be included in the rendered output along with how the data will be displayed. The simplest field type is the BoundField, which displays a data value as text. Other field types display the data using alternate HTML elements. The CheckBoxField, for example, renders as a checkbox whose checked state depends on the value of a specified data field; the ImageField renders an image whose image source is based upon a specified data field. Hyperlinks and buttons whose state depends on an underlying data field value can be rendered using the HyperLinkField and ButtonField field types.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

GridView control to show master-child or master-slave data, written in c#, asp.net

I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend