Dynamically creating Tables and insering rows

sureshcd10

Regular
Joined
Dec 25, 2003
Messages
77
I m faced with the problem of displaing contents from DataTable to to webform.I got the following details
.Im using asp.net and VB.net

Experience Table
===============
Fields in Experience Table: CandID,CompanyName,Desig,Role
Sample Data in ExperienceTable
CandID CompanyName Desig Role
---- ----------- ------ -----
1 Camco SalesMan Role 4 Salesman
1 Amco Superviser Role of Superviser
1 Wesco Captain Roles of Captain
2 Evia CustCare Roles of CustCare


Now I am passing
select * from ExpTable where candId=1
to the DataTable
Then I wanted to get the following output on my WebForm

Experience Details

1) Company Name:Camco
Designation :Salesman
Role :Role 4 Salesman
2) Company Name:Amco
Designation :Superviser
Role :Role of Superviser
3) Company Name:Wesco
Designation :Captain
Role :Roles of Captain

Any better idea 4 getting the output neatly formatted on a webForm

I tried the following way .But I couldn't add rows dynamically.Help me to solve this or suggest me some better way of dislaying a neatly formatted output

I placed one HTml Table control on my web form.Now I Rightclicked this table and made Run as server control.
Now I used DataTable to read data from ExperienceTable

And based on Candid I retrieved records from this ExpDetails Table
Based on the Number of rows retrieved from the DataTable .I wanted to Dynamically add rows for my html table on the webform.

And the data from the dataTable are to be displayed on to these rows and colums in these HtmlTable

First Check if any records are there in DataTable If No records Then it should not create any Table on the Form.

Or if 3 records are in the dataTable Then It should
First Create one Table with 1 row and 1 column
and Display a heading "Experience Details" in it

Then insert Required no.of rows and columns to the heading 4 displaying the results

If my DataTable has only one row then createan HtmlTable with 3 rows and 2 columns

If my DataTable has Three rows then create an HtmlTable with 9 rows and 2 columns
:o :o
 
Back
Top