Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > findcontrol not getting reference to controls in datagrid footer

Reply
Thread Tools

findcontrol not getting reference to controls in datagrid footer

 
 
james_crane@btinternet.com
Guest
Posts: n/a
 
      01-17-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Findcontrol in Gridview Footer row not working kevin@webpageconcepts.com ASP .Net 2 04-26-2007 05:54 PM
FindControl in GridView Footer Andrew Robinson ASP .Net 1 04-24-2007 11:12 PM
Any way to reorder how a datagrid is drawn (header/footer/items vs.header/items/footer)? Henrik ASP .Net Datagrid Control 1 07-06-2006 12:23 AM
findcontrol in datagrid footer Ruby ASP .Net 0 01-28-2004 05:11 AM
Datagrid FindControl in Footer Dave ASP .Net 2 11-14-2003 04:11 PM



Advertisments