Hello,
I have a RadListBox called RadListBoxDestination inside the controls <EditFormSettings EditFormType="Template">
<FormTemplate> (file wucMantenedorVentasPriorizadas.ascx)
What happens is that when I try to call RadListBoxDestination ma I get the following error message:
"Object reference not set to an instance of an object"
For me the problem is that my RadLisBox called RadListBoxDestination is inside the controls <EditFormSettings EditFormType="Template">
<FormTemplate> and I'm not calling it correctly.
For this I have been doing 2 possible logics but I get the same error, these logics are (file wucMantenedorVentasPriorizadas,ascx.cs):
Option 1
logger.Info("RadListBoxDestination: " + RadListBoxDestination);
RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
RadListBoxDestination.DataBind();
Option 2
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)//editform
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
RadListBox RadListBoxDestination = (RadListBox)editItem.FindControl("RadListBoxDestination");
RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
RadListBoxDestination.DataBind();
}
Can you help me how is that How do I reference it so that the data can be loaded dynamically since I put a log to see but no data appears in the RadListBox
Regards
Oscar
I have a RadListBox called RadListBoxDestination inside the controls <EditFormSettings EditFormType="Template">
<FormTemplate> (file wucMantenedorVentasPriorizadas.ascx)
What happens is that when I try to call RadListBoxDestination ma I get the following error message:
"Object reference not set to an instance of an object"
For me the problem is that my RadLisBox called RadListBoxDestination is inside the controls <EditFormSettings EditFormType="Template">
<FormTemplate> and I'm not calling it correctly.
For this I have been doing 2 possible logics but I get the same error, these logics are (file wucMantenedorVentasPriorizadas,ascx.cs):
Option 1
logger.Info("RadListBoxDestination: " + RadListBoxDestination);
RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
RadListBoxDestination.DataBind();
Option 2
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)//editform
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
RadListBox RadListBoxDestination = (RadListBox)editItem.FindControl("RadListBoxDestination");
RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
RadListBoxDestination.DataBind();
}
Can you help me how is that How do I reference it so that the data can be loaded dynamically since I put a log to see but no data appears in the RadListBox
Regards
Oscar