Link to home
Start Free TrialLog in
Avatar of coldchillin
coldchillin

asked on

Displaying a variable

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?
Avatar of brene
brene
Flag of Australia image

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??
Avatar of coldchillin
coldchillin

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of brene
brene
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial