B
bbawa1
I am trying to use cascadingdropdown AJAX control but it gives me
following error. have the following web method
public FoodService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues, string category)
{
string[] _categoryValues = KnownCategoryValues.Split(':',
';');
int _foodID = Convert.ToInt32(_categoryValues[1]);
List<CascadingDropDownNameValue> _foodItems = new
List<CascadingDropDownNameValue>();
dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
new dsFoodTableAdapters.tbparentTableAdapter();
foreach (DataRow _row in _foodAdapter.GetFoodData())
{
_foodItems.Add(new
CascadingDropDownNameValue(_row["category"].ToString(),
_row["categoryID"].ToString()));
}
// convert to array and return the vlaues
return _foodItems.ToArray();
}
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
AjaxControlToolkit.CascadingDropDown.CascadingDropDown_ClientStateValuesLoaded(Object
sender, EventArgs e) +96
AjaxControlToolkit.ExtenderControlBase.LoadClientStateValues() +204
AjaxControlToolkit.ExtenderControlBase.Page_PreLoad(Object sender,
EventArgs e) +28
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreLoad(EventArgs e) +96
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2794
following error. have the following web method
public FoodService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues, string category)
{
string[] _categoryValues = KnownCategoryValues.Split(':',
';');
int _foodID = Convert.ToInt32(_categoryValues[1]);
List<CascadingDropDownNameValue> _foodItems = new
List<CascadingDropDownNameValue>();
dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
new dsFoodTableAdapters.tbparentTableAdapter();
foreach (DataRow _row in _foodAdapter.GetFoodData())
{
_foodItems.Add(new
CascadingDropDownNameValue(_row["category"].ToString(),
_row["categoryID"].ToString()));
}
// convert to array and return the vlaues
return _foodItems.ToArray();
}
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
AjaxControlToolkit.CascadingDropDown.CascadingDropDown_ClientStateValuesLoaded(Object
sender, EventArgs e) +96
AjaxControlToolkit.ExtenderControlBase.LoadClientStateValues() +204
AjaxControlToolkit.ExtenderControlBase.Page_PreLoad(Object sender,
EventArgs e) +28
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreLoad(EventArgs e) +96
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2794