471,603 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Populate Table using Dataset

Hi All,

I haven't got a response for this question lately and i really need to
get this done ASAP.

I have a .aspx page that has table two column four rows on it.
1. How do i use codebehind C# to populate the HTML table?
2. How do i pull some figures from the second column and add them up in
the Total field.

here is a snipplet of the table:
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<table>
<tr>
<td>Funds to Load</td>
<td><input style="WIDTH: 157px"
onchange=calculateTotal name=funds></td></tr>
<tr>
<td style="HEIGHT: 25px">Administrative Charge</td>
<td style="HEIGHT: 25px"><input id=admin
style="WIDTH: 157px; HEIGHT: 22px" disabled readOnly size=21
value=2%
</td></tr> <tr>
<td>Minimum Adjustment</td>
<td><input id=minimum style="WIDTH: 157px" disabled readOnly
value=$1000></td></tr>
<tr>
<td style="HEIGHT: 27px">Total Funds Required</td>
<td style="HEIGHT: 27px"><input id=fundingTotal
style="WIDTH: 157px" disabled readOnly value=$1000</td></tr>

<tr>
<td align=center colSpan=2><input type=submit value="Submit
Request"></td></tr></table>
<asp:Label id=Label1 style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 216px" runat="server" Width="168px" Height="24px">Funds
to Load</asp:Label>
<asp:Label id=Label2 style="Z-INDEX: 102; LEFT: 16px; POSITION:
absolute; TOP: 240px" runat="server" Width="176px"
Height="24px">Administrative Charge</asp:Label>
<asp:Label id=Label3 style="Z-INDEX: 103; LEFT: 16px; POSITION:
absolute; TOP: 264px" runat="server" Width="168px"
Height="24px">Minimum Adjustment</asp:Label>
<asp:Label id=Label4 style="Z-INDEX: 104; LEFT: 16px; POSITION:
absolute; TOP: 288px" runat="server" Width="168px" Height="16px">Total
Funds Required</asp:Label>
<asp:TextBox id=txtFundsToLoad style="Z-INDEX: 105; LEFT: 192px;
POSITION: absolute; TOP: 208px" runat="server" Width="161"
Height="24"></asp:TextBox>
<asp:TextBox id=txtAdmin style="Z-INDEX: 106; LEFT: 192px; POSITION:
absolute; TOP: 232px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:TextBox id=txtMin style="Z-INDEX: 107; LEFT: 192px; POSITION:
absolute; TOP: 256px" runat="server" Width="161px"
Height="24px"></asp:TextBox>
<asp:TextBox id=txtTotal style="Z-INDEX: 108; LEFT: 192px; POSITION:
absolute; TOP: 280px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:Button id=Button1 style="Z-INDEX: 109; LEFT: 104px; POSITION:
absolute; TOP: 317px" runat="server" Width="144px" Text="Submit
Request" Height="25px"></asp:Button></form>
</body>
Someone please help.

Jan 30 '06 #1
2 2592
http://www.c-sharpcorner.com/Code/20...olumnToCal.asp
"Junior" <th********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi All,

I haven't got a response for this question lately and i really need to
get this done ASAP.

I have a .aspx page that has table two column four rows on it.
1. How do i use codebehind C# to populate the HTML table?
2. How do i pull some figures from the second column and add them up in
the Total field.

here is a snipplet of the table:
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<table>
<tr>
<td>Funds to Load</td>
<td><input style="WIDTH: 157px"
onchange=calculateTotal name=funds></td></tr>
<tr>
<td style="HEIGHT: 25px">Administrative Charge</td>
<td style="HEIGHT: 25px"><input id=admin
style="WIDTH: 157px; HEIGHT: 22px" disabled readOnly size=21
value=2%
></td></tr>

<tr>
<td>Minimum Adjustment</td>
<td><input id=minimum style="WIDTH: 157px" disabled readOnly
value=$1000></td></tr>
<tr>
<td style="HEIGHT: 27px">Total Funds Required</td>
<td style="HEIGHT: 27px"><input id=fundingTotal
style="WIDTH: 157px" disabled readOnly value=$1000
></td></tr>

<tr>
<td align=center colSpan=2><input type=submit value="Submit
Request"></td></tr></table>
<asp:Label id=Label1 style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 216px" runat="server" Width="168px" Height="24px">Funds
to Load</asp:Label>
<asp:Label id=Label2 style="Z-INDEX: 102; LEFT: 16px; POSITION:
absolute; TOP: 240px" runat="server" Width="176px"
Height="24px">Administrative Charge</asp:Label>
<asp:Label id=Label3 style="Z-INDEX: 103; LEFT: 16px; POSITION:
absolute; TOP: 264px" runat="server" Width="168px"
Height="24px">Minimum Adjustment</asp:Label>
<asp:Label id=Label4 style="Z-INDEX: 104; LEFT: 16px; POSITION:
absolute; TOP: 288px" runat="server" Width="168px" Height="16px">Total
Funds Required</asp:Label>
<asp:TextBox id=txtFundsToLoad style="Z-INDEX: 105; LEFT: 192px;
POSITION: absolute; TOP: 208px" runat="server" Width="161"
Height="24"></asp:TextBox>
<asp:TextBox id=txtAdmin style="Z-INDEX: 106; LEFT: 192px; POSITION:
absolute; TOP: 232px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:TextBox id=txtMin style="Z-INDEX: 107; LEFT: 192px; POSITION:
absolute; TOP: 256px" runat="server" Width="161px"
Height="24px"></asp:TextBox>
<asp:TextBox id=txtTotal style="Z-INDEX: 108; LEFT: 192px; POSITION:
absolute; TOP: 280px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:Button id=Button1 style="Z-INDEX: 109; LEFT: 104px; POSITION:
absolute; TOP: 317px" runat="server" Width="144px" Text="Submit
Request" Height="25px"></asp:Button></form>
</body>
Someone please help.

Jan 30 '06 #2
First, you'll have to make your table a Server Control by adding a
runat="server" and an id=someTableName to the declaration. Then you can
access the table's Rows and Cells programmatically like this:

someTableName.Rows[0].Cells[1].InnerText = "abcde";

You would have to iterate through your list of data, keeping up with your
totals.

That said, there are a few better solutions for many circumstances:

If you have to use a table, read up on System.Web.UI.WebControls.Table.
That table is completely programmable in code with a much more complete set
of properties and methods.

Even better would be to use a DataGrid or Repeater because you can do data
binding to them. Then in your OnItemDataBound handler, you can sum your
totals and if the Item.ItemType is ListItemType.Footer, you add your text to
Item.Cells[x] where x is the member of the Cells array that you want the
total written to.

HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Junior" wrote:
Hi All,

I haven't got a response for this question lately and i really need to
get this done ASAP.

I have a .aspx page that has table two column four rows on it.
1. How do i use codebehind C# to populate the HTML table?
2. How do i pull some figures from the second column and add them up in
the Total field.

here is a snipplet of the table:
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<table>
<tr>
<td>Funds to Load</td>
<td><input style="WIDTH: 157px"
onchange=calculateTotal name=funds></td></tr>
<tr>
<td style="HEIGHT: 25px">Administrative Charge</td>
<td style="HEIGHT: 25px"><input id=admin
style="WIDTH: 157px; HEIGHT: 22px" disabled readOnly size=21
value=2%
></td></tr>

<tr>
<td>Minimum Adjustment</td>
<td><input id=minimum style="WIDTH: 157px" disabled readOnly
value=$1000></td></tr>
<tr>
<td style="HEIGHT: 27px">Total Funds Required</td>
<td style="HEIGHT: 27px"><input id=fundingTotal
style="WIDTH: 157px" disabled readOnly value=$1000
></td></tr>

<tr>
<td align=center colSpan=2><input type=submit value="Submit
Request"></td></tr></table>
<asp:Label id=Label1 style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 216px" runat="server" Width="168px" Height="24px">Funds
to Load</asp:Label>
<asp:Label id=Label2 style="Z-INDEX: 102; LEFT: 16px; POSITION:
absolute; TOP: 240px" runat="server" Width="176px"
Height="24px">Administrative Charge</asp:Label>
<asp:Label id=Label3 style="Z-INDEX: 103; LEFT: 16px; POSITION:
absolute; TOP: 264px" runat="server" Width="168px"
Height="24px">Minimum Adjustment</asp:Label>
<asp:Label id=Label4 style="Z-INDEX: 104; LEFT: 16px; POSITION:
absolute; TOP: 288px" runat="server" Width="168px" Height="16px">Total
Funds Required</asp:Label>
<asp:TextBox id=txtFundsToLoad style="Z-INDEX: 105; LEFT: 192px;
POSITION: absolute; TOP: 208px" runat="server" Width="161"
Height="24"></asp:TextBox>
<asp:TextBox id=txtAdmin style="Z-INDEX: 106; LEFT: 192px; POSITION:
absolute; TOP: 232px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:TextBox id=txtMin style="Z-INDEX: 107; LEFT: 192px; POSITION:
absolute; TOP: 256px" runat="server" Width="161px"
Height="24px"></asp:TextBox>
<asp:TextBox id=txtTotal style="Z-INDEX: 108; LEFT: 192px; POSITION:
absolute; TOP: 280px" runat="server" Width="161px" Height="24px"
ReadOnly="True" BackColor="#E0E0E0"></asp:TextBox>
<asp:Button id=Button1 style="Z-INDEX: 109; LEFT: 104px; POSITION:
absolute; TOP: 317px" runat="server" Width="144px" Text="Submit
Request" Height="25px"></asp:Button></form>
</body>
Someone please help.

Jan 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Mike Fellows | last post: by
3 posts views Thread by Robert W. | last post: by
2 posts views Thread by Tim Kelley | last post: by
1 post views Thread by rn5a | last post: by
reply views Thread by xmail123 | last post: by
reply views Thread by leo001 | last post: by

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.