Ask a Question related to ASP.NET General, Design and Development.
-
Robin Bonin #1
How do I put a user control into a table?
I have a user control that create a product thumbnail and details. I am
working on aother user control that I will pass some variables like # of
columns and rows to display these thumbnails. I'm having trouble dynamicly
adding a new thumbnail control to my table.
Dim newCell As New TableCell
Dim newRow As New TableRow
Dim productThumb As New htmlBlock_ProductThumb ' This is my
usercontrol
newCell.Controls.Add(productThumb) ' Not
sure how to add it to the table cell
newRow.Cells.Add(newCell)
FeaturedProducts.Rows.Add(newRow)
Robin Bonin Guest
-
user control problem access value from user control to a page
Thanks a lot for paying attention to my problem , i tell u the problem i have a main form in which i gave a login label that points to a... -
Know in user control page_load if an user control event is going to be fired
Hi all, i have built a user control that shows a map and let the user zoom in, out, usual stuff. Putting this object in a webform the user can... -
Dynamic user control in a table.
I have a user control, htmlBlock_ProductThumb that I would like to add to a dot net table. I'm not sure how to get the output of the usercontrol... -
Web user control content doesn't resize in web form table
Hi Paul: The only suggestion I could give is to wrap the table with a <div> tag, and set the width of that <div> to be 100%. ASP.NET controls... -
Using Table control in a custom composite control. Control does not render properly in design time.
All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control... -
S. Justin Gengo #2
Re: How do I put a user control into a table?
Robin,
When you load a user control it's slightly different than creating a dynamic
control.
newCell.Controls.Add(LoadControl([Path to your user control as String])
And you won't need to create the user control before this so delete the
line:
Dim productThumb As New htmlBlock_ProductThumb ' This is my usercontrol
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"Robin Bonin" <robin@guavatools.com> wrote in message
news:3FWdnbRIWMP_LaqiU-KYvw@eatel.net...Not> I have a user control that create a product thumbnail and details. I am
> working on aother user control that I will pass some variables like # of
> columns and rows to display these thumbnails. I'm having trouble dynamicly
> adding a new thumbnail control to my table.
>
> Dim newCell As New TableCell
> Dim newRow As New TableRow
> Dim productThumb As New htmlBlock_ProductThumb ' This is my
> usercontrol
>
> newCell.Controls.Add(productThumb) '> sure how to add it to the table cell
> newRow.Cells.Add(newCell)
>
> FeaturedProducts.Rows.Add(newRow)
>
>
S. Justin Gengo Guest
-
Robin Bonin #3
Re: How do I put a user control into a table?
Found the answer to my question.
for reference...
Dim newCell As New TableCell
Dim newRow As New TableRow
Dim productThumb As New Control
productThumb =
LoadControl("../userControls/htmlBlock_ProductThumb.ascx")
CType(productThumb, htmlBlock_ProductThumb).itemSku = "1001A"
newCell.Controls.Add(productThumb)
newRow.Cells.Add(newCell)
FeaturedProducts.Rows.Add(newRow)
"Robin Bonin" <robin@guavatools.com> wrote in message
news:556cnasC49bBKqqiXTWJjA@eatel.net...I> This worked great, I just have one problem.
> I need to pass atleast one paramater to this control for the item ID to be
> dsiplayed.
>
> I declared the control as follows.
> productThumb = LoadControl("../userControls/htmlBlock_ProductThumb.ascx")
>
> but the public properties are not exposed though the productThumb control.usercontrol> tried passing a variable
> through the querry string but I got an error. control needs to end with a
> .ascx.
>
>
>
> "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
> news:%2328pEtBYDHA.416@tk2msftngp13.phx.gbl...> dynamic> > Robin,
> >
> > When you load a user control it's slightly different than creating a> > control.
> >
> > newCell.Controls.Add(LoadControl([Path to your user control as String])
> >
> > And you won't need to create the user control before this so delete the
> > line:
> >
> > Dim productThumb As New htmlBlock_ProductThumb ' This is myam> >
> > Sincerely,
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > [url]www.aboutfortunate.com[/url]
> >
> > "Out of chaos comes order."
> > Nietzche
> >
> >
> > "Robin Bonin" <robin@guavatools.com> wrote in message
> > news:3FWdnbRIWMP_LaqiU-KYvw@eatel.net...> > > I have a user control that create a product thumbnail and details. Iof> > > working on aother user control that I will pass some variables like #'> dynamicly> > > columns and rows to display these thumbnails. I'm having trouble> > > adding a new thumbnail control to my table.
> > >
> > > Dim newCell As New TableCell
> > > Dim newRow As New TableRow
> > > Dim productThumb As New htmlBlock_ProductThumb ' This is my
> > > usercontrol
> > >
> > > newCell.Controls.Add(productThumb)>> > Not> >> > > sure how to add it to the table cell
> > > newRow.Cells.Add(newCell)
> > >
> > > FeaturedProducts.Rows.Add(newRow)
> > >
> > >
> >
>
Robin Bonin Guest



Reply With Quote

