?
Solved

Displaying a variable

Posted on 2008-10-06
3
Medium Priority
?
251 Views
Last Modified: 2013-12-17
I simple do not know how to display a variable on a page. The DAL approach I am using is code-behind TableAdapters.

I know how to use a TableAdapter and bind that to a repeater, table, etc. but I want to display a variable, possibly in a label, without using Design Mode, and without inline coding any sql statements.

Is it possible to accomplish this using the TableAdapter method, and do I have to assign some object the variable, or can I just display it in the presentation layer?
0
Comment
Question by:coldchillin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:brene
ID: 22657326
If you have the variable in the code behind then follow this:
In the code behind (somewhere in the Page_Load):
string variableToDisplay = "I want this on the web page";
label1.Text = variableToDisplay;

In the aspx:
<asp:label id="label1" runat="server" Text="" />

Does that answer your question??
0
 
LVL 1

Author Comment

by:coldchillin
ID: 22661466
Using the tableadapter method, I have the following, which I am not able to make work:

azjobsiteTableAdapters.seekerProfileTableAdapter seeker = new azjobsiteTableAdapters.seekerProfileTableAdapter();
        Label1.Text = seeker.GetResumeViews(Convert.ToInt32(Session["rUserID"]));

My presentation layers looks like this:
<asp:Label ID="Label1" runat="server" Text="<%# DataBinder.Eval(Container.DataItem, "datePosted") %>"></asp:Label>

The error I get is that the server tag is not well formed.
0
 
LVL 4

Accepted Solution

by:
brene earned 2000 total points
ID: 22664972
You need to use single quotes when calling some code eg.

<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "datePosted") %>'></asp:Label>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question