Placeholder in datagrid/datalist

  • Thread starter Thread starter Chad Crowder
  • Start date Start date
C

Chad Crowder

Is it possible to create a placeholder inside a template column of a
datagrid? My goal is to use a placeholder, and during runtime add user
controls to the placeholder as the items in the datagrid are being built.

I've tried doing this with a simple link button, but I get the "Object
Reference not set to an instance of an object" whenever I try to view the
page.

Here's the html code for the placeholder in my datagrid:
<ItemTemplate>
<asp:PlaceHolder ID="test" Runat="server"
Visible="True"></asp:PlaceHolder>
</ItemTemplate>

Here's the section of code I'm trying via the itemcreated sub for the
datagrid...
Dim myPlace As PlaceHolder
myPlace = e.Item.FindControl("test")
Dim newbutton As New LinkButton
newbutton.Text = "Hit Me"
ewbutton.ID = "sale" & e.Item.ItemIndex
myPlace.Controls.Clear()
myPlace.Controls.Add(newbutton)

Any Help is appreciated!

- Chad
 
Hi Steve,

thanks for the prompt help. I've actually not had a chance to try your
suggestions yet. We ended up using a panel, and was successfully using
that.

- Chad
 
Back
Top