473,657 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding <div> tag programatically

Hi All,

I would like to add the <div> tag programatically from the code-behind
of my aspx file. Basically, I would like to a table to this <div>.
There are a number of tables which are created dynamically in the
code-behind. Each table should go to its own <div> tag.
The reason that I can't have the <div> tags in aspx is that the number
of the tables is unknown until runtime and each table should go into
its own <div> tag.
How is this possible?
Thanks.
Nov 18 '05 #1
3 30443
using System.Web.UI.H tmlControls;

HtmlGenericCont rol div1 = new HtmlGenericCont rol("div");
div1.ID = "div1";
// add whatever attributes you need, eg make it scrollable:
div1.Attributes["style"] = "overflow: auto; width: 400px; height: 150px;";

// initialize your table
HtmlTable table1 = new HtmlTable();
table1.ID = "table1";
//....

// add the table to the div:
div1.Controls.A dd(table1);

// add it to some PlaceHolder:
placeHolder1.Co ntrols.Add(div1 );

Greetings
Martin
"DJ Dev" <ri*********@ic n.siemens.com> wrote in message
news:11******** *************** **@posting.goog le.com...
Hi All,

I would like to add the <div> tag programatically from the code-behind
of my aspx file. Basically, I would like to a table to this <div>.
There are a number of tables which are created dynamically in the
code-behind. Each table should go to its own <div> tag.
The reason that I can't have the <div> tags in aspx is that the number
of the tables is unknown until runtime and each table should go into
its own <div> tag.
How is this possible?
Thanks.

Nov 18 '05 #2
Use the ASP.Net Panel control, which renders a div on the client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DJ Dev" <ri*********@ic n.siemens.com> wrote in message
news:11******** *************** **@posting.goog le.com...
Hi All,

I would like to add the <div> tag programatically from the code-behind
of my aspx file. Basically, I would like to a table to this <div>.
There are a number of tables which are created dynamically in the
code-behind. Each table should go to its own <div> tag.
The reason that I can't have the <div> tags in aspx is that the number
of the tables is unknown until runtime and each table should go into
its own <div> tag.
How is this possible?
Thanks.

Nov 18 '05 #3
Use the ASP.Net Panel control, which renders a div on the client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DJ Dev" <ri*********@ic n.siemens.com> wrote in message
news:11******** *************** **@posting.goog le.com...
Hi All,

I would like to add the <div> tag programatically from the code-behind
of my aspx file. Basically, I would like to a table to this <div>.
There are a number of tables which are created dynamically in the
code-behind. Each table should go to its own <div> tag.
The reason that I can't have the <div> tags in aspx is that the number
of the tables is unknown until runtime and each table should go into
its own <div> tag.
How is this possible?
Thanks.

Nov 18 '05 #4

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

Similar topics

13
3392
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to <foo/>) From XHTML specification:
1
2501
by: Philo | last post by:
How do I select all <div> tags except those which contain a <table> tag somewhere within them? Example XML: <********************** sample input ***********************> <txtSectionBody> <div> <span>
4
3553
by: Akbar | last post by:
All, I'm currently using an alt attribute in a div tag to store "keywords" for a function that will show or hide certain div's based on a given keyword. Is there a better (standard) place to put these keywords? Code can be seen at http://www.straffin.com/test/DUdyn2.html . This is just a sample... the real "keywords" (and other information) will be pulled out of an XML file, not programatically generated.
8
14461
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a page, there is a huge gap (like 3/8 inch or 25 px) between them. This is driving me bananas. What the hey am I missing? dh ------------------------------------------------ Dan Hansen ------------------------------------------------
1
1333
by: Steve Klett | last post by:
Hi- I was just looking at te source for a site that I really liked and I noticed they are using DIV tags where I assumed that would be using a mess of nested tables. Now, this looks like a much cleaner way to do things. My question, as an absolute newbie to <div> tags is can you access them anyway like you can access a placeholder? I have a site that uses a single main placeholder, then, based on what the user navigates too, I load...
1
402
by: DJ Dev | last post by:
Hi All, I would like to add the <div> tag programatically from the code-behind of my aspx file. Basically, I would like to a table to this <div>. There are a number of tables which are created dynamically in the code-behind. Each table should go to its own <div> tag. The reason that I can't have the <div> tags in aspx is that the number of the tables is unknown until runtime and each table should go into its own <div> tag. How is this...
4
1859
by: Alan Silver | last post by:
Hello, I would like to know if it is possible to use a panel, but prevent it from adding a <div> tag to the HTML. The reason I want to do this is that I am using a panel to enable me to show/hide part of a page as required. I would like the part in the panel to appear on the same line as the controls that precede it, but when the panel is converted to HTML, a <div> tag is used, and that forces a new line in the browser. Any ideas? TIA
3
3806
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644" onclick="__doPostBack('SitesRadioButtonList_3','')" language="javascript" />
4
1497
by: Jeff | last post by:
Hello, I'm fairly new to asp.net programming (I come from a C++ background) and am still finding some things very confusing. I wondered if anyone could help me with the following issue. I managed to add a handler function to my project which uses GDI+ to resize a largish image down to an arbitray size. Now I'd like to be able to get the required sizes programatically from the enclosing <divbut I'm struggling to see how to do that. For...
8
10029
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
8310
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
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
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
4158
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
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
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.