Solved

Displaying a variable

Posted on 2008-10-06
3
236 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
  • 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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

786 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