473,408 Members | 2,417 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,408 software developers and data experts.

Is there a way to bind a simple Table or similar to...

a custom object. Similar to how I bind a collection of objects to a
repeater. Is there a way to bind a single object to a Table? I could use a
repeater, but seems over kill for a single object.

Thanks for any help.
Feb 23 '06 #1
5 1381
forgot to add, ASP.NET 1.1

"Jaybuffet" wrote:
a custom object. Similar to how I bind a collection of objects to a
repeater. Is there a way to bind a single object to a Table? I could use a
repeater, but seems over kill for a single object.

Thanks for any help.

Feb 23 '06 #2
In the code-behind make a protected property that will go to the table and
derive the value you want to bind to. Bind to the property like this:

<td><%# SalesTotal %></td>

where SalesTotal is a protected property in the code-behind.

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
a custom object. Similar to how I bind a collection of objects to a
repeater. Is there a way to bind a single object to a Table? I could use
a
repeater, but seems over kill for a single object.

Thanks for any help.

Feb 23 '06 #3
I was hoping to bind to the table, ie. <table DataSource=<%# myobj %> then
use <td><%# DataBinder.Eval(Container.DataItem, "property")%>td>
Creating protected properties in the code behind for each property in my
object may be a hassle, but its an option. Perhaps I am missing something.
Just wondering if there is another way.

Thanks for your reply

"Eliyahu Goldin" wrote:
In the code-behind make a protected property that will go to the table and
derive the value you want to bind to. Bind to the property like this:

<td><%# SalesTotal %></td>

where SalesTotal is a protected property in the code-behind.

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
a custom object. Similar to how I bind a collection of objects to a
repeater. Is there a way to bind a single object to a Table? I could use
a
repeater, but seems over kill for a single object.

Thanks for any help.


Feb 23 '06 #4
Ok, what you are after is binding a table rather than binding to the table.

No, an html table doesn't support DataSource. Instead you can do something
like
<table>
<asp:repeater ... DataSource= ...>
<asp:ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem, "property")%></td></tr>
</asp:ItemTemplate>
</asp:repeater>
</table>

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:F2**********************************@microsof t.com...
I was hoping to bind to the table, ie. <table DataSource=<%# myobj %> then
use <td><%# DataBinder.Eval(Container.DataItem, "property")%>td>
Creating protected properties in the code behind for each property in my
object may be a hassle, but its an option. Perhaps I am missing
something.
Just wondering if there is another way.

Thanks for your reply

"Eliyahu Goldin" wrote:
In the code-behind make a protected property that will go to the table
and
derive the value you want to bind to. Bind to the property like this:

<td><%# SalesTotal %></td>

where SalesTotal is a protected property in the code-behind.

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
>a custom object. Similar to how I bind a collection of objects to a
> repeater. Is there a way to bind a single object to a Table? I could
> use
> a
> repeater, but seems over kill for a single object.
>
> Thanks for any help.


Feb 23 '06 #5
Thats what I figured, but I was thinking a repeater might be over kill for a
single object, not a collection.

"Eliyahu Goldin" wrote:
Ok, what you are after is binding a table rather than binding to the table.

No, an html table doesn't support DataSource. Instead you can do something
like
<table>
<asp:repeater ... DataSource= ...>
<asp:ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem, "property")%></td></tr>
</asp:ItemTemplate>
</asp:repeater>
</table>

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:F2**********************************@microsof t.com...
I was hoping to bind to the table, ie. <table DataSource=<%# myobj %> then
use <td><%# DataBinder.Eval(Container.DataItem, "property")%>td>
Creating protected properties in the code behind for each property in my
object may be a hassle, but its an option. Perhaps I am missing
something.
Just wondering if there is another way.

Thanks for your reply

"Eliyahu Goldin" wrote:
In the code-behind make a protected property that will go to the table
and
derive the value you want to bind to. Bind to the property like this:

<td><%# SalesTotal %></td>

where SalesTotal is a protected property in the code-behind.

Eliyahu

"Jaybuffet" <Ja*******@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
>a custom object. Similar to how I bind a collection of objects to a
> repeater. Is there a way to bind a single object to a Table? I could
> use
> a
> repeater, but seems over kill for a single object.
>
> Thanks for any help.


Feb 23 '06 #6

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

Similar topics

1
by: Achille Carette | last post by:
Hello all, I noticed a difference in the explain plans between JDBC using bind variables (PreparedStatement) and SQLPlus for the same query. The query made through JDBC using bind variables...
1
by: Daniel Roy | last post by:
Hi gurus, I just started to look at a very slow-running SQL statement generated by an application (Siebel). I spooled the SQL from the application, replaced the bind variables by their values, and...
3
by: Venkata C | last post by:
Hi! We are running DB2 V8 on z/OS in compatibility mode. There is one specific query (embedded as static SQL in a COBOL program) that causes the bind job to abend when we use the DEGREE(ANY)...
3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
3
by: Bob Clegg | last post by:
I am in the same boat as Moondog on the 2nd July. I have a report designed against a dataset. Proved the datasset is OK by dropping a datagrid onto the form and it binds OK to the data. But the...
2
by: Neo | last post by:
I put a similar post for CheckBoxes, but i want to use a Radio button & not a CheckBox I have a field named "Male" & this is of SQL BIT data type (SQL Server). How can i bind this field to a...
2
by: duancg | last post by:
Hi, I wonder if someone could help since I wasn't able to find the answer through search. I have a simple .aspx page that shows data from a database table, as a table in UI. Now the data uses...
0
by: sean worlock | last post by:
Hello all, I have googled like crazy for this with no sucess! I have a dataset containing a table with the following fields Table===Widths ---------------------------------------------...
6
by: pretzla | last post by:
I have a PL/SQL script where I load data from a stored procedure into bind variables. Then, I insert that data from the bind variables into an Oracle table with a simple insert statement. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.