473,765 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Produ ctThumb ' This is my
usercontrol

newCell.Control s.Add(productTh umb) ' Not
sure how to add it to the table cell
newRow.Cells.Ad d(newCell)

FeaturedProduct s.Rows.Add(newR ow)
Nov 17 '05 #1
2 1370
Robin,

When you load a user control it's slightly different than creating a dynamic
control.

newCell.Control s.Add(LoadContr ol([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_Produ ctThumb ' This is my usercontrol

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Robin Bonin" <ro***@guavatoo ls.com> wrote in message
news:3F******** ************@ea tel.net...
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_Produ ctThumb ' This is my
usercontrol

newCell.Control s.Add(productTh umb) ' Not sure how to add it to the table cell
newRow.Cells.Ad d(newCell)

FeaturedProduct s.Rows.Add(newR ow)

Nov 17 '05 #2
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_Produ ctThumb.ascx")
CType(productTh umb, htmlBlock_Produ ctThumb).itemSk u = "1001A"
newCell.Control s.Add(productTh umb)

newRow.Cells.Ad d(newCell)
FeaturedProduct s.Rows.Add(newR ow)
"Robin Bonin" <ro***@guavatoo ls.com> wrote in message
news:55******** ************@ea tel.net...
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_Produ ctThumb.ascx")

but the public properties are not exposed though the productThumb control. I tried passing a variable
through the querry string but I got an error. control needs to end with a
.ascx.

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
Robin,

When you load a user control it's slightly different than creating a

dynamic
control.

newCell.Control s.Add(LoadContr ol([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_Produ ctThumb ' This is my usercontrol

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Robin Bonin" <ro***@guavatoo ls.com> wrote in message
news:3F******** ************@ea tel.net...
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_Produ ctThumb ' This is my
usercontrol

newCell.Control s.Add(productTh umb)

' Not
sure how to add it to the table cell
newRow.Cells.Ad d(newCell)

FeaturedProduct s.Rows.Add(newR ow)



Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1492
by: Jason | last post by:
I am pretty new to C# so bare with me... The design of my website utilizes tables on every page that look almost identical, save the data they are displaying. I have written the code to create the body of these tables using a DataGrid, so I can dynamically add rows to the table without modifying the HTML. Now, I want to put this DataGrid into a user control that I can include in the HTML code, then control the behavior of that DataGrid...
0
2505
by: fernandezr | last post by:
I've got a user control which I reference twice on the same page. On the first instance of the control I need to change the skin of the table and it's textboxes to use specific skinids defined in the theme for my site. How and where do I do this? Here is the page calling the user control, profile.aspx: <%@ Page debug="true" MasterPageFile="~/MasterPage_MOR.master" Title="MOR Profile" Language="C#" StyleSheetTheme="MSB"...
0
1094
by: fernandezr | last post by:
I've got a user control,ucAddress.ascx, which I reference twice on the same page. On the first instance of the control I need to change the skin of the table and it's textboxes to use specific skinids defined in the theme for my site. How and where do I do this? Here is the page calling the user control, profile.aspx: <%@ Page debug="true" MasterPageFile="~/MasterPage_MOR.master"
0
1837
by: noname | last post by:
i have a few user controls that need a "visible" property. one example is an error box. the error box's visible property would only be set in the event of an error, of course. i've come up with two methods to do this, neither of which seem optimal. 1. user control consists of simply a single <asp:label>. all output - be it table tags, row tags, etc. - is set to the label's text property when the user control's visible property is...
11
5002
by: trinitypete | last post by:
Hi all, I have a user control that uses control literal to build a heading with a link, and a div containing links below. As the link heading is hit, I want to change the style of the div, making it visible or not. Yep you guessed it, expanding tree type functionality. The header has an onclick event onclick='Doexpandcollapse
1
1062
by: Ben | last post by:
Hi, I would like to use web user contols for header and footer controls. The problem I'm having is that we're using tables for layout. (thanks for any pro css solutions, but thats' a different thread :)) So in the header I want to output say.. <table><tr><td><script src="foo.js"></script></td><td> Only if the page requires the menu, otherwise, none of that html should be sent... I can set the property to determine if the data...
0
1698
by: clintonG | last post by:
I applied aspnet_regsql to SQL2K which was working fine throughout Beta 2 development. After installing Visual Studio and SQL Express RTM my application has blown up. Logging in to the application became realllllllllllly slow. Content in LoginView Role Groups was not displaying even after a user in a role had logged in. It was taking about 15 seconds or so for the login control to display when the login link was selected on the homepage....
2
3089
by: Scott | last post by:
I'm using a master page (mp_TableMaint.aspx) with one Content area (ID: Content1). Content1 contains several usercontrols, which are hidden. The goal is to show the correct control based on the querystring passed when calling mp_TableMaint (the page is called from an ASP.NET 2.0 Menu control on my index.aspx page). I believe I understand correctly that the Master Page's ASP Content control (named Content1) is, itself, a server side...
8
3026
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
0
5293
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all the days in the week with dates and textboxes to fill in some data. row 1: question
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.