J
J055
Hi
I have a FormView, Panel and ObjectDataSource control. I'm trying to change
the Panel.Visible property to true based on a value in the ReturnValue
object in the ObjectDataSource.Selected event. I can't find the Panel
control from the inside the Selected event method even though the control is
available earlier in the page life cycle, e.g.
protected void odsAccount_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.ReturnValue != null)
{
ScsDataSet.AccountsDataTable accTbl =
(ScsDataSet.AccountsDataTable)e.ReturnValue;
if ((AccountTypes)accTbl[0].AccountType == AccountTypes.Student)
{
Panel panel = (Panel)FindControl("panParents");
// Error occurs here - Object reference not set to an instance of an
object.
panel.Visible = true;
}
}
}
I can access the panParents control from the Page_Load which occurs first.
What am I doing wrong.
Thanks
Andrew
I have a FormView, Panel and ObjectDataSource control. I'm trying to change
the Panel.Visible property to true based on a value in the ReturnValue
object in the ObjectDataSource.Selected event. I can't find the Panel
control from the inside the Selected event method even though the control is
available earlier in the page life cycle, e.g.
protected void odsAccount_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.ReturnValue != null)
{
ScsDataSet.AccountsDataTable accTbl =
(ScsDataSet.AccountsDataTable)e.ReturnValue;
if ((AccountTypes)accTbl[0].AccountType == AccountTypes.Student)
{
Panel panel = (Panel)FindControl("panParents");
// Error occurs here - Object reference not set to an instance of an
object.
panel.Visible = true;
}
}
}
I can access the panParents control from the Page_Load which occurs first.
What am I doing wrong.
Thanks
Andrew