Looking for syntax help.
I have a method that get's called by a dropdownlist in the EditItemTemplate of a DataGrid:protected DataTable NearbyEmployees(string store,string chain,string city,string state)
DataTable dt = DAL.Employee.AvailableEmployees(store,chain,city,state);return dt;
I need to set the DataSource of the DropDownList, for example if hardcoded, could be:
This works fine, now,
I need to pass parameters using DataBinder.Eval(Container.DataItem, "values") so tried something like:
DataSource='<%#(NearbyEmployees(DataBinder.Eval(Container.DataItem,"store",etc. but getting error that has invalid values.
Any help is greatly appreciated.
Thanks for the response. This gives me the following error:
CS0118: 'System.Web.UI.WebControls.DataGridItem.DataItem' denotes a 'property' where a 'method' was expected
This produces the following error:
CS0021: Cannot apply indexing with  to an expression of type 'object'
hm..I have used Container.DataItem("col") a lot in my pages and it worked, but I am also using VB.NET. I am not sure about that in C#. I think its just a syntax problem. See if this articles helps at all.
Sonu Kapoor [MVP]
Feel free to ask me any .NET question | Ajax Data Controls Forum