[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Displaying a variable

Posted on 2008-10-06
3
Medium Priority
?
258 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 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