user control in datagrid

P

phil2phil

Hi,
I wanted to know if there is any way to display a user control inside a
datagrid, I just need to display products on a website, 2 columns, 2
rows at a time, with a next prev links/buttons, thats why i was
thinking about using a datagrid. But I need it formatted a certain
way, display Image and text to the side in, is it possible to have this
in a datagrid? If so, could someone please point me to a tutorial,
we're using asp.net 1.1.

Thanks.
 
D

dave.hillegass

First you need to register your control in the page that hosts the
DataGrid with something like this.
<%@ Register TagPrefix="uc1" TagName="UserControl1"
Src="UserControl.ascx" %>

After that you just need to drop your user control into an
TemplateColumn's ItemTemplate like this.

<asp:TemplateColumn>
<ItemTemplate>
<uc1:UserControl1 id="MyUC" runat="server"></uc1:UserControl>
</ItemTemplate>
<asp:TemplateColumn>

Everything else should be handled by the user control
 
P

phil2phil

Hi,
Thanks for the help, i'm going to give this is a shot, but is there
anyway to display the grid in a 2x2 format? having it display 2
products next to each other, rather than one on top of the other?

thanks.
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top