joshuadavidlee
asked on
double quotes in c#
Page.RegisterStartupScript ("ScrollPa nel", "<script language=""javascript"">do cument.get ElementByI d('" & myControl.ClientID & "').scrollIntoView();</scr ipt>")
translate this please someone into c# focusing on the double quotes near the word javascript, its giving me a headache.
translate this please someone into c# focusing on the double quotes near the word javascript, its giving me a headache.
Try this:
add Using System.Text;
StringBuilder sBuilder = new StringBuilder();
sBuilder.Append("<script language='javascript'>docu ment.getEl ementById( '")
sBuilder.Append(myControl. ClientID)
sBuilder.Append("').scroll IntoView() ;</script> ")
Page.RegisterStartupScript ("ScrollPa nel", sBuilder.ToString());
add Using System.Text;
StringBuilder sBuilder = new StringBuilder();
sBuilder.Append("<script language='javascript'>docu
sBuilder.Append(myControl.
sBuilder.Append("').scroll
Page.RegisterStartupScript
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
C#
Page.RegisterStartupScript ("ScrollPa nel", "<script language='javascript'>docu ment.getEl ementById( '" + myControl.ClientID + "').scrollIntoView();</scr ipt>");
Page.RegisterStartupScript
ASKER
ok so many good answers umm i will give to the guy who said replace quotes with the slash cause it answers the question more accuratly even though javascript taking single quotes is nice and elegant alos, thanks for answers
You can use single quote in javascript.
I prefer a clearer way for building string.
Page.RegisterStartupScript
Edwin