H
H5N1
Hello everybody
I'm stuck for a long time with the following problem, so I will be
really gratefull if you could help me a bit:
I have a GridView nested in DataList (it's located in DataList's Item
Template together with it's data source).
In OnRowUpdated event of child GridView I'm calling DataBind() on
parent DataList, since I want it to reflect the changes (maybe there's
better way to refresh the datalist?)
I get the following error:
==========
"The ObjectDataSource control 'odsGridViewObjectDataSource' does not
have a naming container. Ensure that the control is added to the page
before calling DataBind. "
==========
It happens when during rebinding of datalist, rebinding of child
gridview is called ( on ItemDataBound event), more precisly when
FindControl is called:
protected void DataList1_ItemDataBound(Object sender,
System.Web.UI.WebControls.DataListItemEventArgs e) {
odsGridViewObjectDataSource =
(ObjectDataSource)(e.Item.FindControl("odsGridViewObjectDataSource"));
try
{
odsodsGridViewObjectDataSource.SelectParameters["CostID"].DefaultValue
= DataBinder.Eval(e.Item.DataItem, "CostID").ToString();
}
thank you a LOT
I'm stuck for a long time with the following problem, so I will be
really gratefull if you could help me a bit:
I have a GridView nested in DataList (it's located in DataList's Item
Template together with it's data source).
In OnRowUpdated event of child GridView I'm calling DataBind() on
parent DataList, since I want it to reflect the changes (maybe there's
better way to refresh the datalist?)
I get the following error:
==========
"The ObjectDataSource control 'odsGridViewObjectDataSource' does not
have a naming container. Ensure that the control is added to the page
before calling DataBind. "
==========
It happens when during rebinding of datalist, rebinding of child
gridview is called ( on ItemDataBound event), more precisly when
FindControl is called:
protected void DataList1_ItemDataBound(Object sender,
System.Web.UI.WebControls.DataListItemEventArgs e) {
odsGridViewObjectDataSource =
(ObjectDataSource)(e.Item.FindControl("odsGridViewObjectDataSource"));
try
{
odsodsGridViewObjectDataSource.SelectParameters["CostID"].DefaultValue
= DataBinder.Eval(e.Item.DataItem, "CostID").ToString();
}
thank you a LOT