J
james_crane
Hi,
Really stuck here so help would be greatly appreaciated.
I have a datagrid and am adding a calander control to the footer
dynamically...
if(e.Item.ItemType == ListItemType.Footer)
{
Calendar cal = new Calendar();
cal.ID = "calDate";
cal.Visible = false;
e.Item.Cells[0].Controls.Add(cal);
}
etc
Later on I require a reference to this calendar and have tried 3
routes...
Calendar cal = (Calendar)Page.FindControl("calDate");
Calendar cal = (Calendar)Datagrid.FindControl("calDate");
and also looping through the datagrid thus...
foreach(DataGridItem di in dgProjectHours.Items)
{
Calendar cal = (Calendar)
di.FindControl("calDate");
}
Each of these methods return NULL - the loop attempt only every scans
item/alternatingitem collection so that not a surprise - but if anyone
can tell me how to get a reference to a control added to a datagrid
control at runtime I woudl be gratefull.
Many thanks
Really stuck here so help would be greatly appreaciated.
I have a datagrid and am adding a calander control to the footer
dynamically...
if(e.Item.ItemType == ListItemType.Footer)
{
Calendar cal = new Calendar();
cal.ID = "calDate";
cal.Visible = false;
e.Item.Cells[0].Controls.Add(cal);
}
etc
Later on I require a reference to this calendar and have tried 3
routes...
Calendar cal = (Calendar)Page.FindControl("calDate");
Calendar cal = (Calendar)Datagrid.FindControl("calDate");
and also looping through the datagrid thus...
foreach(DataGridItem di in dgProjectHours.Items)
{
Calendar cal = (Calendar)
di.FindControl("calDate");
}
Each of these methods return NULL - the loop attempt only every scans
item/alternatingitem collection so that not a surprise - but if anyone
can tell me how to get a reference to a control added to a datagrid
control at runtime I woudl be gratefull.
Many thanks