ASP.NET (C#) Question

Gridview, system.data.datarowview' does not contain a property

iam getting a error when trying to make a dropdown list in asp.net. hoping you guys can help because i dont know what else to try anymore..
The error: "system.data.datarowview' does not contain a property with the name 'Suppstatus'.", sounds like ive spelled something wrong but ive tripple checked.

template code:

<asp:TemplateField>
<ItemTemplate>
<asp:Label Text='<%#Eval("Suppstatus") %>' Visible="false" ID="lblsuppStatus" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList runat="server" ID="ddlSupStatus"> </asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>


Code behind:

protected void grvSupplierStatus_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex)
{
DropDownList ddlSupStatus = (DropDownList)e.Row.FindControl("ddlSupstatus");
Label lblsuppstatus = (Label)e.Row.FindControl("lblsuppStatus");
DataSet ds = new DataSet();
ds = GetYesNoValue("Suppstatus");
DataTable dt = new DataTable();
dt = ds.Tables[0];
ddlSupStatus.DataSource = dt;
ddlSupStatus.DataTextField = "Suppstatus";
ddlSupStatus.DataValueField = "Suppstatus";
ddlSupStatus.DataBind();
ddlSupStatus.Items.FindByValue(lblsuppstatus.Text).Selected = true;

}

}
catch (Exception ex)
{
}

}

public DataSet GetYesNoValue(string ColumnName)
{
DataTable dtVal = new DataTable();
DataColumn column;
DataRow row;

column = new DataColumn();
column.DataType = System.Type.GetType("System.String");
column.ColumnName = ColumnName;
dtVal.Columns.Add(column);

DataSet dsVal = new DataSet();

dtVal.Rows.Add("--Select--");
dtVal.Rows.Add("Yes");
dtVal.Rows.Add("No");

dsVal.Tables.Add(dtVal);

return dsVal;
}

Answer

You're using a circuitous approach to insert your data. You could also

replace

<asp:DropDownList runat="server" ID="ddlSupStatus" ></asp:DropDownList>

with

<asp:DropDownList runat="server" ID="ddlSupStatus" Selected='<%# Bind("Suppstatus") %>'> 
   <asp:ListItem Text="--Select--" Value="--Select--"></asp:ListItem>
   <asp:ListItem Text="Yes" Value="Yes"></asp:ListItem>
   <asp:ListItem Text="No" Value="No"></asp:ListItem> 
</asp:DropDownList>

without any action codebehind