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 Pre开发者_开发技巧ss 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
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.
}
}
http://quickstarts.asp.net/QuickStartV20/aspnet/
here are lot of samples in VB as well in C#
精彩评论