473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1408
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
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
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
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
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
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
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
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
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
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
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
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
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...
0
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
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,...

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.