Hi I want to get data dropdown in gridview. How can I do. I did like below but get blank.
private DataTable CheckedData()
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] { new DataColumn("UrunAd"), new DataColumn("Stok", typeof(int)), new DataColumn("Pozisyon") });
foreach (GridViewRow rw in example.Rows)
{
if (rw.RowType == DataControlRowType.DataRow)
{
CheckBox chk = (CheckBox)rw.Cells[0].FindControl("chcsec");
if (chk.Checked)
{
Label lb = (Label)rw.Cells[1].FindControl("lblUrun");
Label lb1 = (Label)rw.Cells[2].FindControl("lblStok");
DropDownList drp = (DropDownList)rw.Cells[5].FindControl("drpEleman");
dt.Rows.Add(lb.Text, lb1.Text, drp.SelectedItem.Value);
}
}
}
return dt;
}