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!

Almost there...adding new literal control to datagrid

Status
Not open for further replies.

wsmall73

Programmer
May 23, 2002
261
US
I am implementing adding a popup calendar to a datagrid and I have everything working as it should however I would like the image that fires off the popup to appear in a different location withing my datagrid.

Int32 iLastCellIndex = e.Item.Cells.Count-1;

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;; //The HTML to add to the Edit cell


e.Item.Cells[iLastCellIndex].Controls.Add(new LiteralControl(sLink2)); //Add the HTML

this obviously adds it to the end of the already created controls...

is there a way to insert the control in the middle of those controls so that the image for the calendar popup appears next to the textbox to which the value for the date will be returned. Any help would be greatly appreciated and as I am all googled out...
 
.Controls has an .AddAt() method which is basically an insert. Just pick your index and insert away.
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
having another issue... now when I do the insert into my datagrid using the addat.. I can no longer access the controls that are after that control using ((DropDownList)e.Item.FindControl(&quot;ddl_active_ind&quot;)).SelectedItem.Value
etc....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top