views:

89

answers:

2

Using VB.Net

Am new to vb.net, Am using datagridview

DataGridview

ID Name ComboboxColumn

001 Raja 
002 Ravi
003 Suresh
...,

"Save" - Button

In a Datagridview am Using combobox column in a third column

Suppose If i select the value from the combobox, then i Press the save button means, The Datagridview column value should save in the table.

If am not selected the value in the combobox, the ID and Name should not save in the table.

How to make a query or code for this condition?

Need vb.net code Help

+1  A: 

http://quickstarts.asp.net/QuickStartV20/aspnet/

here are lot of samples in VB as well in C#

Saar
DataGridView is a winforms control
Meta-Knight
+1  A: 

loop through the rows of the GridView

for(int i=0; i<= GridView1.Rows.Count-1; i++)
{
    string comboValue = ((DropdownList)GridView1.Rows[i].FindControl("Dropdownlist1")).SelectedValue;
    if(comboValue == "Yes")
    {

       //Save to database. Alternatively, you can load it in your business entity object and loop through the object collection and save it to the database individually.
    }

}
Bhaskar
Am Using VB.Net, How to change your code.
Gopal
Use one of the **many** C#-to-VB.NET converters online, e.g. http://www.developerfusion.com/tools/convert/csharp-to-vb/
marc_s
The question seems to be about winforms DataGridView not asp.net's GridView.
Meta-Knight
see this...you will get some help from here --> http://www.codeproject.com/KB/webforms/GridViewInsideGridView.aspx (but this is c#). You can translate it.
Bhaskar