Hey,
Below is some code to generate an HtmlTable dynamically, however the table
does not show on page.
When tracing through, the values from the database come out correctly, but
the table never displays.
Can anyone see anything that could possibly be the reason ?
Thanks,
t1 = new HtmlTable();
int maxrows = 0;
int maxcolumns = 0;
maxrows = ds.Tables["Products"].Rows.Count;
maxcolumns = ds.Tables["Products"].Columns.Count;
int row = 0;
for( int i = 0; i < maxrows - 1; i++)
{
HtmlTableRow r = new HtmlTableRow();
row = row + 1;
for( int j = 0; j < maxcolumns - 1; j++)
{
HtmlTableCell c = new HtmlTableCell() ;
c.Controls.Add( new
LiteralControl( Convert.ToStrin g(ds.Tables["Products"].Rows[i].ItemArray[j])));
r.Cells.Add(c);
}
t1.Rows.Add(r);
}
t1.Visible = true;
--
Al 2 1158
It looks like you've forgotten this important line:
Page.Controls.A dd(t1);
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Al Wilkerson" <ac***@comcast. net> wrote in message
news:kN******** ************@co mcast.com... Hey,
Below is some code to generate an HtmlTable dynamically, however the table does not show on page. When tracing through, the values from the database come out correctly, but the table never displays. Can anyone see anything that could possibly be the reason ? Thanks,
t1 = new HtmlTable();
int maxrows = 0; int maxcolumns = 0; maxrows = ds.Tables["Products"].Rows.Count; maxcolumns = ds.Tables["Products"].Columns.Count;
int row = 0;
for( int i = 0; i < maxrows - 1; i++) { HtmlTableRow r = new HtmlTableRow(); row = row + 1;
for( int j = 0; j < maxcolumns - 1; j++) { HtmlTableCell c = new HtmlTableCell() ;
c.Controls.Add( new LiteralControl( Convert.ToStrin g(ds.Tables["Products"].Rows[i].ItemArray[j]))); r.Cells.Add(c); } t1.Rows.Add(r);
}
t1.Visible = true;
-- Al
Someone mentioned that I forgot to add "Page.Controls. Add(t1)", but that
didn't work either.
Al
"Al Wilkerson" <ac***@comcast. net> wrote in message
news:kN******** ************@co mcast.com... Hey,
Below is some code to generate an HtmlTable dynamically, however the table does not show on page. When tracing through, the values from the database come out correctly, but the table never displays. Can anyone see anything that could possibly be the reason ? Thanks,
t1 = new HtmlTable();
int maxrows = 0; int maxcolumns = 0; maxrows = ds.Tables["Products"].Rows.Count; maxcolumns = ds.Tables["Products"].Columns.Count;
int row = 0;
for( int i = 0; i < maxrows - 1; i++) { HtmlTableRow r = new HtmlTableRow(); row = row + 1;
for( int j = 0; j < maxcolumns - 1; j++) { HtmlTableCell c = new HtmlTableCell() ;
c.Controls.Add( new LiteralControl( Convert.ToStrin g(ds.Tables["Products"].Rows[i].ItemArray[j]))); r.Cells.Add(c); } t1.Rows.Add(r);
}
t1.Visible = true;
-- Al This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ajay Desh |
last post by:
Hi
I am gettin error, if i try to find the top position of a table.
Here is what i am doing.I have a HtmlTable (Table3 is the name/id)
created.It has a position and a Top and Left co-ordinates assigned. I
have a button to add a row to this table. When i click on this button
the code behind is :
private void add_ServerClick(object sender, System.EventArgs e)
{
|
by: Michael Meckelein |
last post by:
Hi all!
I have a table like
Table myTable = new Table();
Now, I want to publish the table as part of a webpage and as part of a word
document. I tried to convert the table, but the compiler say
"Cannot convert type 'System.Web.UI.WebControls.Table' to
'System.Web.UI.HtmlControls.HtmlTable'"
if I use (HtmlTable)myTable.
|
by: Jay |
last post by:
I have been trying to link and HTML Table to a Code behind variable. I have
seen people saying that they can do this but I cannot get it to work. What
am i missing?
In the HTML Code I have:
AutoEventWireup="true" in the serverside tags at the top of the file
....<Table ID="tLinks" runat="server">...</TABLE>...
In the code behind file I have:
Protected WithEvents tLinks as System.Web.UI.HTMLControls.HTMLTable
|
by: Leo |
last post by:
I created a user control which is some text contained in a HtmlTable.
I put this control into main form. I would like to have the ability to
move this control around in the main form. I think one way to do this
is to change the style of this control at runtime ("Left:xx px; Top:xx
px"). Another way is to move the HtmlTable in the control (i.e. change
the style of it). However I couldn't figure out how to let it work. At
design time, I...
|
by: Al Wilkerson |
last post by:
Hey,
I have a Web Form with a drop down list, textbox, and search button.
When click the search button an SQL server database is queried fordata.
Once I have the data in a dataset I use the dataset to dynamically create a
Html Table control.
I want to display the table on another frame page (target="main") without
the web form controls (i.e. the textbox, search button, and dropdown list).
I just want the table displayed only on the...
| |
by: Al Wilkerson |
last post by:
Hey,
I have a Web Form with a drop down list, textbox, and search button.
When click the search button an SQL server database is queried fordata.
Once I have the data in a dataset I use the dataset to dynamically create a
Html Table control.
I want to display the table on another frame page (target="main") without
the web form controls (i.e. the textbox, search button, and dropdown list).
I just want the table displayed only on the...
|
by: TRobran |
last post by:
What I'm trying to do seems pretty straightforward so I must be missing
something simple. Any help is greatly appreciated.
On my page I have a DropDownList, a HtmlTable and a Button. Each row in the
HtmlTable consists of 5 cells individually populated with a single checkbox.
The DropDownList value dictates what populates the HtmlTable. On the
SelectedIndexChanged event of the DropDownList I populate the HtmlTable based
on the...
|
by: Tim::.. |
last post by:
Can someone please help....
I'm having major issues with a user control I'm tring to create!
I an trying to execute a sub called UploadData() from a user control which I
managed to do but for some reason I keep getting the error:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
|
by: Scott McNair |
last post by:
Hi all,
I have a page that displays an order confirmation to the end-user whenever
he places an order. On that order is a table generated using
System.Web.UI.HtmlControls.HtmlTable. My company also wants to be able to
email the contents of the page (including the table). Unfortunately I
can't find a way to bind HtmlTable to an SMTPMail.Body.
Is there a way to do this? If not, is there a way to pull the HTML out of
the table in...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |