469,926 Members | 2,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Need help with populating table control with data from a data set

Hi,

I don't have much knowledge of the table control. I am basically trying to
use a table thats populated with data rows from a dataSet but currently
things aren't working for me.

below is the sample HTML that I have:

<asp:TableRow>
<asp:TableCell Text="Company" ID="CompanyCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Paygroup" ID="PaygroupCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="paygroup descr" ID="PaygroupDescr"
Runat="server"></asp:TableCell>
</asp:TableRow>

------------

In addition, I think I need some VB code to assign the particular data rows
to the table columns, but I'm not sure of the syntax:

Table1.ID("Company") = Dr("Company")

Any help would be much appreciated.
Thanks,

Gavin

--
You've got to live and learn...
Nov 19 '05 #1
3 1357
Gavin,

If for whatever reason you are not happy with the datagrid that would do all
the work for you, you can use a repeater and setup the itemtemplate to
resemble the table row (<tr>) with the cells (<td>s) bound to the dataset
columns.

Eliyahu

"gg77" <gg**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Hi,

I don't have much knowledge of the table control. I am basically trying to
use a table thats populated with data rows from a dataSet but currently
things aren't working for me.

below is the sample HTML that I have:

<asp:TableRow>
<asp:TableCell Text="Company" ID="CompanyCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Paygroup" ID="PaygroupCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="paygroup descr" ID="PaygroupDescr"
Runat="server"></asp:TableCell>
</asp:TableRow>

------------

In addition, I think I need some VB code to assign the particular data rows to the table columns, but I'm not sure of the syntax:

Table1.ID("Company") = Dr("Company")

Any help would be much appreciated.
Thanks,

Gavin

--
You've got to live and learn...

Nov 19 '05 #2
Hi Eliyahu,

Thanks for your help.

Can you please give me an idea of how the syntax would kind of look using a
"repeater"?

Thanks,

Gavin
P.S.--The reason why I don't want to use a datagrid is because I'm trying to
put in logic that collapses rows when there are values of zero or null. I
don't think a datagrid can do this.
"Eliyahu Goldin" wrote:
Gavin,

If for whatever reason you are not happy with the datagrid that would do all
the work for you, you can use a repeater and setup the itemtemplate to
resemble the table row (<tr>) with the cells (<td>s) bound to the dataset
columns.

Eliyahu

"gg77" <gg**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Hi,

I don't have much knowledge of the table control. I am basically trying to
use a table thats populated with data rows from a dataSet but currently
things aren't working for me.

below is the sample HTML that I have:

<asp:TableRow>
<asp:TableCell Text="Company" ID="CompanyCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Paygroup" ID="PaygroupCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="paygroup descr" ID="PaygroupDescr"
Runat="server"></asp:TableCell>
</asp:TableRow>

------------

In addition, I think I need some VB code to assign the particular data

rows
to the table columns, but I'm not sure of the syntax:

Table1.ID("Company") = Dr("Company")

Any help would be much appreciated.
Thanks,

Gavin

--
You've got to live and learn...


Nov 19 '05 #3
Ok, here is a fregment taken from one of my pages.

<table id="tblCharges" width="100%" cellspacing="3"
style="table-layout:fixed;background-color:#f0ffff">
<colgroup>
<col width="3ex">
<col width="8ex" class="SelectionGridItem">
<col width="18ex" class="SelectionGridItem">
<col width="10ex" class="SelectionGridItem">
<col width="10ex" class="SelectionGridItem">
</colgroup>
<asp:Repeater Runat="server" id="dgCharges" DataSource="<%#
DSChartCharges %>" DataMember="tblChartCharges"
OnItemDataBound="dgCharges_ItemDataBound" >
<HeaderTemplate>
<tr>
<td>&nbsp;</td>
<td class="SelectionGridHeader">CPT</td>
<td class="SelectionGridHeader">Mod</td>
<td class="SelectionGridHeader">ICD-9</td>
<td class="SelectionGridHeader">ICD-9</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><span runat="server" id="lblNumber"><%#
((DataRowView)Container.DataItem) ["Rank"] %></span></td>
<td><input type="text" Runat="server" id=txtCpt
class="ChargeInput"
value='<%# ((DataRowView)Container.DataItem) ["CptCode"] %>'
onfocus="codeGotFocus()" onblur="codeLostFocus()"
onkeypress="return keyPressed();"></td>
<td><input type="text" Runat="server" id="txtMods"
class="ChargeInput"
onfocus="modsGotFocus()" onblur="modsLostFocus()"
onkeypress="return keyPressed();"></td>
<td><input type="text" Runat="server" id="txtIcd91"
class="ChargeInput"
value='<%# ((DataRowView)Container.DataItem) ["Icd91"] %>'
onfocus="codeGotFocus()" onblur="codeLostFocus()"
onkeypress="return keyPressed();"></td>
<td><input type="text" Runat="server" id="txtIcd92"
class="ChargeInput"
value='<%# ((DataRowView)Container.DataItem) ["Icd92"] %>'
onfocus="codeGotFocus()" onblur="codeLostFocus()"
onkeypress="return keyPressed();"></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table
Eliyahu

"gg77" <gg**@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Hi Eliyahu,

Thanks for your help.

Can you please give me an idea of how the syntax would kind of look using a "repeater"?

Thanks,

Gavin
P.S.--The reason why I don't want to use a datagrid is because I'm trying to put in logic that collapses rows when there are values of zero or null. I
don't think a datagrid can do this.
"Eliyahu Goldin" wrote:
Gavin,

If for whatever reason you are not happy with the datagrid that would do all the work for you, you can use a repeater and setup the itemtemplate to
resemble the table row (<tr>) with the cells (<td>s) bound to the dataset columns.

Eliyahu

"gg77" <gg**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Hi,

I don't have much knowledge of the table control. I am basically trying to use a table thats populated with data rows from a dataSet but currently things aren't working for me.

below is the sample HTML that I have:

<asp:TableRow>
<asp:TableCell Text="Company" ID="CompanyCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Paygroup" ID="PaygroupCode"
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="paygroup descr" ID="PaygroupDescr"
Runat="server"></asp:TableCell>
</asp:TableRow>

------------

In addition, I think I need some VB code to assign the particular data

rows
to the table columns, but I'm not sure of the syntax:

Table1.ID("Company") = Dr("Company")

Any help would be much appreciated.
Thanks,

Gavin

--
You've got to live and learn...


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Dan | last post: by
1 post views Thread by Oliver Gabriel | last post: by
1 post views Thread by Al Wilkerson | last post: by
5 posts views Thread by Sonu.NET | last post: by
2 posts views Thread by adrin | last post: by
2 posts views Thread by Geary | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.