I created a user control in ASP.net C# with a Dropdownlist in it (called LookupGrid below). Now in the main form , I want to set the data source for the Combobox, but I am getting NullExceptions when on the line that sets the datasource for the combobox
Code in the main web form :
LookupGrid droplist = new LookupGrid();
droplist.ID = field.Name;
RecordSet lookupvalues = inRecs.ServiceClient.WebServiceClient.GetInstance().GetLookup("CurrentNRS_Admit", Convert.ToInt64(Session["UserID"].ToString()), field);
droplist.SetData(lookupvalues.ToDataSet());
In the user control :
protected void Page_Load(object sender, EventArgs e)
{
}
public void SetData(DataSet dTLookupValues)
{
DropDownList1.DataSource = dTLookupValues.Tables[0];
}
I am getting error:
Object reference not set to an instance of an object.
On this line:
DropDownList1.DataSource = dTLookupValues.Tables[0];