Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controls.AddAt in DataGrid

Status
Not open for further replies.

wsmall73

Programmer
May 23, 2002
261
US
After adding a literal control using the AddAt Method I can no long access those controls that are in the controls list after the insert
Ex. AddAt(14,blahblah)

I can not access the controls that I would assume were in the 15, 16,17 positions using
((DropDownList)e.Item.FindControl("ddl_active_ind")).SelectedItem.Value

Anyone have any ideas??
 
After you do the .AddAt(), what does:

Code:
e.Item.Controls.Count

return?

And (most importantly), what was it before you execute the .AddAt()?

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Returns 24 before and 25 after....

Here's my code
String sLink2 = &quot;<a href=\&quot;javascript:pickDate('&quot; +
sTextBoxName2 + &quot;');\&quot;><IMG SRC=\&quot;images/iCalendar.gif\&quot; border=\&quot;0\&quot; align=\&quot;absmiddle\&quot;></a>&quot;;

e.Item.Cells[1].Controls.AddAt(14,new LiteralControl(sLink2)); //Add the HTML

What I am trying is this...
emp_no=((DropDownList)(e.Item.Cells[1].FindControl(&quot;ddl_employees&quot;))).SelectedItem.Value;


which works fine if I pull out adding the literal using the AddAt. Thanks for assisting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top