Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newline in constant in ASP.Net!!! 1

Status
Not open for further replies.

z07924

IS-IT--Management
Feb 18, 2002
122
GB
I am getting error on the below code.

void Page_Load()
{
lblOperDesc.Text = '" + Session["gUserID"] + "'";
}

The error is given below,
Compiler Error Message: CS1010: Newline in constant

Line 17: void Page_Load()
Line 18: {
Line 19: lblOperDesc.Text = '" + Session["gUserID"] + "'";
Line 20: }
Line 21:


Source File: c:\inetpub\ Line: 19

I don't know what is causing that problem.
Please help me out.

Thanks in Advance,
Laks
 
Why do you have the single quotes around the session var?

you have this

'" + Session["gUserID"] + "'";

Now you should be able to just go

lblOperDesc = Session["gUserID"]

Or, you should put a double quote before the first single quote like this:
"'" + Session["gUserID"] + "'";

if you have to have the single quotes there. I'm guessing that because that first single quote isn't wrapped around double quotes, its screwing somethign up.

hth

D'Arcy
 
Instead of space/apostophe/double-quote after =
lblOperDesc.Text = '" + Session["gUserID"] + "'";
do you want space/double-quote/apostophe/double-quote after =
lblOperDesc.Text = "'" + Session["gUserID"] + "'";


Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Thanks. I am sorry.I missed my doouble quotes. I don't even realize that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top