473,513 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access object through C# loop

I have an aspx page that contains 5 tables. Each table I have Named
tblSection1, tblSection2, tblSection3, tblSection4, tblSection5 respectively
and reside in a corresponding panel for collapse and placement purposes.

I have a loop in the code behind that will add rows and cells for each table
based on what is needed for that particular table. What I need to do is be
able to add a row to my table based on the pass of the loop I am in. Pass 1
add rows to tblSection1, Pass 2 add rows to tblSection2 and so on.. I am
having trouble calling the table control using the sectionCtr parameter as
seen below

My loop looks like this

//set up section count to also use as an input parm for the proc
int sectionCnt, sectionCtr;
sectionCnt = 1;

for(sectionCtr=1; sectionCtr <= sectionCnt; sectionCtr++)
{
//Run a bunch of code to populate DS and use results to build each table.
//....bla bla code

tblSection1.Rows.Add(tRow);
//I would like this to call the table based on the pass.
}

Any help is appreciated.
Jul 21 '05 #1
2 1413
Define an array with the tables to use contained therein and use the
sectionCtr as the index into the array.

HTH,

Tim Wallace
"Phil" <Ph**@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I have an aspx page that contains 5 tables. Each table I have Named
tblSection1, tblSection2, tblSection3, tblSection4, tblSection5
respectively
and reside in a corresponding panel for collapse and placement purposes.

I have a loop in the code behind that will add rows and cells for each
table
based on what is needed for that particular table. What I need to do is be
able to add a row to my table based on the pass of the loop I am in. Pass
1
add rows to tblSection1, Pass 2 add rows to tblSection2 and so on.. I am
having trouble calling the table control using the sectionCtr parameter as
seen below

My loop looks like this

//set up section count to also use as an input parm for the proc
int sectionCnt, sectionCtr;
sectionCnt = 1;

for(sectionCtr=1; sectionCtr <= sectionCnt; sectionCtr++)
{
//Run a bunch of code to populate DS and use results to build each table.
//....bla bla code

tblSection1.Rows.Add(tRow);
//I would like this to call the table based on the pass.
}

Any help is appreciated.

Jul 21 '05 #2
This is what I did to solve it....

string str = "tblSection" + sectionCtr;
Table tblCtl = (System.Web.UI.WebControls.Table)FindControl(str);
tblCtl.Rows.Add(tRow);
"Tim Wallace" wrote:
Define an array with the tables to use contained therein and use the
sectionCtr as the index into the array.

HTH,

Tim Wallace
"Phil" <Ph**@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I have an aspx page that contains 5 tables. Each table I have Named
tblSection1, tblSection2, tblSection3, tblSection4, tblSection5
respectively
and reside in a corresponding panel for collapse and placement purposes.

I have a loop in the code behind that will add rows and cells for each
table
based on what is needed for that particular table. What I need to do is be
able to add a row to my table based on the pass of the loop I am in. Pass
1
add rows to tblSection1, Pass 2 add rows to tblSection2 and so on.. I am
having trouble calling the table control using the sectionCtr parameter as
seen below

My loop looks like this

//set up section count to also use as an input parm for the proc
int sectionCnt, sectionCtr;
sectionCnt = 1;

for(sectionCtr=1; sectionCtr <= sectionCnt; sectionCtr++)
{
//Run a bunch of code to populate DS and use results to build each table.
//....bla bla code

tblSection1.Rows.Add(tRow);
//I would like this to call the table based on the pass.
}

Any help is appreciated.


Jul 21 '05 #3

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

Similar topics

1
1645
by: Job Lot | last post by:
I have written 6 Queries in an Access DB, which are executed in a For Each…Next loop to populate DataSet object. A new DataTable object is created in DataSet for each query, as follows Private...
2
9035
by: Alain. | last post by:
Good evenig to all, I use Access 2000 and i want to build a database for my photographs (jpeg files). All the 3 methods I saw make the base grow up. Is it a activeX control which could display...
11
4025
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
7
5430
by: Colleyville Alan | last post by:
I have an app that uses Access to grab various PowerPoint slides using the followhyperlink command. I have set the PPT window to run in a minimized state: FollowHyperlink link Set oPres =...
4
2531
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
7
8823
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
6552
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
8
3976
by: doomx | last post by:
I'm using SQL scripts to create and alter tables in my DB I want to know if it's possible to fill the description(like in the Create table UI) using these scripts. EX: CREATE TABLE(...
4
6368
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
6
5589
by: venmore | last post by:
Hi Can someone please point in the right direction. I have an XML file that gets updated every 4 hours on a web server. I can check the XML modification time in ASP and compare to the databse....
0
7373
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,...
0
7432
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...
0
7519
tracyyun
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...
0
5677
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,...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
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...

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.