<asp:DropDownList Runat="server" ID="currency" CssClass="form" Width=60 />
private void Bind_Currency()
{
string strSql = "SELECT id,currency from currency order by id";
DataSet ds = new DataSet();
try
{
ds = SqlHelper.ExecuteDataset(DBConnection.ConnString, CommandType.Text, strSql);
}
catch (Exception)
{
Response.Redirect("../error.aspx", true);
}
this.currency.DataSource = ds.Tables[0].DefaultView;
this.currency.DataTextField = "currency";
this.currency.DataValueField = "currency";
try
{
this.currency.DataBind(); //throw exception
}
catch (Exception e)
{
string r = e.ToString();
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
this.currency.DataSource = ds.Tables[0].DefaultView;
this.currency.DataTextFiel
this.currency.DataValueFie