I have been working on my web form in 6 days and i am still in the begining.
here is my code and the Error is "Object reference not set to an instase of an object"
public partial class SearchUC : System.Web.UI.UserControl, ISelectedTitleFeed
{
private DataSet DS;
protected void SearchButton_Click(object sender, EventArgs e)
{
DS = minWebService(); // a reference to a web service, returns a dataset
foreach (DataRow DR in DS.Tables["items"].Rows)
{
DropDownlist1.Items.Add(DR["title"].ToString());
}
}
protected void DropDownList1_Changed(object sender, EventArgs e)
{
string temp = string.empty;
foreach (DataRow DR in DS.Tables["items"].Rows) // here i get the error.
temp += DR["title"].ToString();
Label1.Text = temp;
}
}
I must say that i click on Button first then i choose a item in the DropDownlist
here is my code and the Error is "Object reference not set to an instase of an object"
public partial class SearchUC : System.Web.UI.UserControl, ISelectedTitleFeed
{
private DataSet DS;
protected void SearchButton_Click(object sender, EventArgs e)
{
DS = minWebService(); // a reference to a web service, returns a dataset
foreach (DataRow DR in DS.Tables["items"].Rows)
{
DropDownlist1.Items.Add(DR["title"].ToString());
}
}
protected void DropDownList1_Changed(object sender, EventArgs e)
{
string temp = string.empty;
foreach (DataRow DR in DS.Tables["items"].Rows) // here i get the error.
temp += DR["title"].ToString();
Label1.Text = temp;
}
}
I must say that i click on Button first then i choose a item in the DropDownlist