Placeholder in datagrid/datalist

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
 
C

Chad Crowder

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,230
Latest member
LifeBoostCBD

Latest Threads

Top