hi,
I have a problem regarding the retrieval of data from a table.
Here's is what I am doing.
I have a created a table and from added the rows and columns and also data dynamically from the code in one of the function. Now I need to access that table and data on a button click, i.e. when a user clicks button I must be able to get the table information cell-wise. I have written the following code and when the user clicks the button all I get is the row count (i.e. no. of rows in the table are correct) but I cannot retrieve the cell information (or I have to say they are all empty). I have also tried to put the table into one Session but it also returned the same result. So is there any way this can be done. Does anyone has any idea about this.
Help required urgently
Looking forward to your support
Thanks Inserting into table at button click - protected void btnAdvance_Click(object sender, EventArgs e)
-
{
-
Hashtable hsh = (Hashtable)Session["documentHash"];
-
Panel1.Visible = true;
-
tbl = new Table();
-
Panel1.Controls.Add(tbl);
-
tbl.GridLines = GridLines.Both;
-
int docListCount = AssocDocList.Items.Count;
-
TableRow tr = new TableRow();
-
TableCell tc1 = new TableCell();
-
TableCell tc2 = new TableCell();
-
TableCell tc3 = new TableCell();
-
tc1.Controls.Add(new LiteralControl("Document Type ID"));
-
tr.Cells.Add(tc1);
-
tc2.Controls.Add(new LiteralControl("Document ID"));
-
tr.Cells.Add(tc2);
-
tc3.Controls.Add(new LiteralControl("Display Type"));
-
tr.Cells.Add(tc3);
-
tbl.Rows.Add(tr);
-
for (int j = 0; j < docListCount; j++)
-
{
-
DropDownList ddl = new DropDownList();
-
ddl.ID = "drop" + j;
-
ddl.Items.Clear();
-
ddl.Items.Add("PP");
-
ddl.Items.Add("PD");
-
ddl.Items.Add("DP");
-
ddl.Items.Add("DD");
-
TableRow r = new TableRow();
-
for (int i = 0; i < 3; i++)
-
{
-
TableCell c = new TableCell();
-
if (i == 0)
-
c.Controls.Add(new LiteralControl(hsh[AssocDocList.Items[j].Text].ToString()));
-
else if (i == 1)
-
c.Controls.Add(new LiteralControl(AssocDocList.Items[j].Text));
-
else
-
c.Controls.Add(ddl);
-
-
r.Cells.Add(c);
-
}
-
//Table1.Rows.Add(r);
-
tbl.Rows.Add(r);
-
//Session["tbl"] = Table1;
-
}
-
//Session["tbl"] = Table1;
-
}
Retriving the table information on this button click to save in the DB
Gives header information as it is already in .aspx page but not the cell information added from the above button click - protected void btnSave_Click(object sender, EventArgs e)
-
{
-
DocWizProjectControl pj = new DocWizProjectControl();
-
pj.CreatedBy = "ADMIN";
-
//Table table = new Table();
-
//table = (Table) Session["tbl"];
-
int rowCount = tbl.Rows.Count;
-
for (int i = 0; i < rowCount; i++)
-
{
-
//string doc_type_id = tbl.Rows[i].Cells[0].Text;
-
string document_name = tbl.Rows[i].Cells[1].Text;
-
}
-
}
3 1878
hi,
I have a problem regarding the retrieval of data from a table.
Here's is what I am doing.
I have a created a table and from added the rows and columns and also data dynamically from the code in one of the function. Now I need to access that table and data on a button click, i.e. when a user clicks button I must be able to get the table information cell-wise. I have written the following code and when the user clicks the button all I get is the row count (i.e. no. of rows in the table are correct) but I cannot retrieve the cell information (or I have to say they are all empty). I have also tried to put the table into one Session but it also returned the same result. So is there any way this can be done. Does anyone has any idea about this.
Help required urgently
Looking forward to your support
Thanks Inserting into table at button click - protected void btnAdvance_Click(object sender, EventArgs e)
-
{
-
Hashtable hsh = (Hashtable)Session["documentHash"];
-
Panel1.Visible = true;
-
tbl = new Table();
-
Panel1.Controls.Add(tbl);
-
tbl.GridLines = GridLines.Both;
-
int docListCount = AssocDocList.Items.Count;
-
TableRow tr = new TableRow();
-
TableCell tc1 = new TableCell();
-
TableCell tc2 = new TableCell();
-
TableCell tc3 = new TableCell();
-
tc1.Controls.Add(new LiteralControl("Document Type ID"));
-
tr.Cells.Add(tc1);
-
tc2.Controls.Add(new LiteralControl("Document ID"));
-
tr.Cells.Add(tc2);
-
tc3.Controls.Add(new LiteralControl("Display Type"));
-
tr.Cells.Add(tc3);
-
tbl.Rows.Add(tr);
-
for (int j = 0; j < docListCount; j++)
-
{
-
DropDownList ddl = new DropDownList();
-
ddl.ID = "drop" + j;
-
ddl.Items.Clear();
-
ddl.Items.Add("PP");
-
ddl.Items.Add("PD");
-
ddl.Items.Add("DP");
-
ddl.Items.Add("DD");
-
TableRow r = new TableRow();
-
for (int i = 0; i < 3; i++)
-
{
-
TableCell c = new TableCell();
-
if (i == 0)
-
c.Controls.Add(new LiteralControl(hsh[AssocDocList.Items[j].Text].ToString()));
-
else if (i == 1)
-
c.Controls.Add(new LiteralControl(AssocDocList.Items[j].Text));
-
else
-
c.Controls.Add(ddl);
-
-
r.Cells.Add(c);
-
}
-
//Table1.Rows.Add(r);
-
tbl.Rows.Add(r);
-
//Session["tbl"] = Table1;
-
}
-
//Session["tbl"] = Table1;
-
}
Retriving the table information on this button click to save in the DB
Gives header information as it is already in .aspx page but not the cell information added from the above button click - protected void btnSave_Click(object sender, EventArgs e)
-
{
-
DocWizProjectControl pj = new DocWizProjectControl();
-
pj.CreatedBy = "ADMIN";
-
//Table table = new Table();
-
//table = (Table) Session["tbl"];
-
int rowCount = tbl.Rows.Count;
-
for (int i = 0; i < rowCount; i++)
-
{
-
//string doc_type_id = tbl.Rows[i].Cells[0].Text;
-
string document_name = tbl.Rows[i].Cells[1].Text;
-
}
-
}
Doesn't anyone know what the problem is with this code and why I am failing to get the required output? Please help needed greatly.
If I was going to do this I would probably populate the table in the page load and then only make the panel visble on the button click to show the results. HTH.
That may not be possible as I need to generate table depending upon the number of lists in a listbox the user selects and then get the values generated on that table. So any other idea, please
But thanks for trying.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gaz |
last post by:
Hi,
I need to have a table nested within another table. The tables are
alongside each other visually speaking, and the nested table (on the
right) can vary in size. My problem is that when the nested table has
more rows than the first table, the first table (on the left) pads out
its rows so that the table matches the height of the nested table.
I don't want this it happen.. I just want the nested table to be
longer than the first...
|
by: Toby Austin |
last post by:
I'm trying to replace <table>s with <div>s as much as possible.
However, I can't figure out how to do the following…
<table>
<tr>
<td valign="top" width="100%">some data that will 'stretch'</td>
<td valign="top" width="300">some data that won't 'stetch'</td>
</tr>
</table>
|
by: Terrence Brannon |
last post by:
I don't know what Postgres considers a relation and had no intention of
creating one when piping my schema to it... I always DROP TABLE before
CREATE TABLE, so here are the ERRORS emitted when building the database:
3:ERROR: table "country" does not exist
6:ERROR: table "customer" does not exist
11:ERROR: table "product" does not exist
15:ERROR: table "license" does not exist
19:ERROR: table "enduser" does not exist
24:ERROR: ...
|
by: maricel |
last post by:
I have the following base table structure - DDL:
CREATE TABLE "ADMINISTRATOR"."T1" (
"C1" INTEGER NOT NULL )
IN "TEST_TS" ;
ALTER TABLE "ADMINISTRATOR"."T1"
ADD PRIMARY KEY
|
by: Simone Battagliero |
last post by:
I wrote a program which inserts and finds elements in an hash table.
Each element of the table is a dinamic list, which holds all elements
having the same hash value (calculated by an int hashFunction(char
*key, int elements) ), so the table is an array of dynamic lists.
The version of the program I've attached to this message works fine;
but it's the result of an accurate debugging. I discovered that my
problems consisted in just 4 lines...
| |
by: phil-news-nospam |
last post by:
Is there really any advantage to using DIV elements with float style
properies, vs. the old method of TABLE and TR and TD?
I'm finding that by using DIV, it still involves the same number of
elements in the HTML to get everything just right. When you consider
the class attribute on the DIV elements, there's not much size savings
anymore for using DIV.
There are other disadvantages to not using TABLE/TR/TD, such as the
lack of ability...
|
by: MMcCarthy |
last post by:
Normalisation is the term used to describe how you break a file down into tables to create a database. There are 3 or 4 major steps involved known as 1NF (First Normal Form), 2NF (Second Normal Form), 3NF (Third Normal Form) and BCNF (Boyce-Codd Normal Form). There are others but they are rarely if ever used. A database is said to be Normalised if it is in 3NF (or ideally in BCNF). These steps are descibed as follows:
Note: When attribute...
|
by: Kamal |
last post by:
Hello all,
I have a very simple html table with collapsible rows and sorting
capabilities. The collapsible row is hidden with css rule
(display:none). When one clicks in the left of the expandable row, the
hidden row is made visible with css. The problem is when i sort the
rows, the hidden rows get sorted as well which i don't want and want
to be moved (while sorting) relative to their parent rows. The
following is my complete html code...
|
by: wugon.net |
last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad
query performance
Env:
db2 LUW V8 + FP14
Problem :
We have history data from 2005/01/01 ~ 2007/05/xx in single big
table,
we try separate this big table into twelve tables and create a view
|
by: jrod11 |
last post by:
hi,
I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes.
There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)?
Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html
Here is some jquery js that I think...
|
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: 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...
|
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...
|
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,...
|
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: 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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |