stategically place javascript???

  • Thread starter Thread starter DaveF
  • Start date Start date
D

DaveF

Is there any way to to build javascrip on the client and place it exactly
where I want it in the html?
 
this is all client stuff, why post to a server dev group?

Anyway, just put in a <span> or <div> tag and have the clientside code write
to that ID.

Please followup in a clientside/javascript group.
 
slap in a container and add your JavaScript as a LiteralControl. A panel is
as good an object as any (writes out as a <span> tag).

Panel1.Controls.Add(new LiteralControl("my javascript block");


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
RegisterClientScriptBlock: places the script right after the <form>
RegisterStartupScript: places the script before </form> (after all controls)

to place it anywhere else, use a placeholder control, say

<head runat=server id=header>
</head>

then using the generic control, add script:

HtmlGenericControl sc = new HtmlGenericControl("script");
sc.InnerHtml = javascriptCode;
header.Controls.Add(sc);


-- bruce (sqlwork.com)
 
Thanks for the ideas. Basically I am trying to build a Tree structure with
multiple branches. It has LOTS of data. It is a skills matrix. I am woried
about it being slow. What is the best practice to code this. It almost seems
like old asp do while would be faster?

--


David Fetrow
Helixpoint LLC.
http://www.helixpoint.com
(e-mail address removed)
bruce barker said:
RegisterClientScriptBlock: places the script right after the <form>
RegisterStartupScript: places the script before </form> (after all controls)

to place it anywhere else, use a placeholder control, say

<head runat=server id=header>
</head>

then using the generic control, add script:

HtmlGenericControl sc = new HtmlGenericControl("script");
sc.InnerHtml = javascriptCode;
header.Controls.Add(sc);


-- bruce (sqlwork.com)
 
I highly doubt ASP will be any faster - after all, it would be doing the
exact same thing, just in a different way maybe.

If you are sending tons of stuff to the client, that has tons of
javascript - then that will always be slow, the burden will be on the client
browser. I wouldn't worry about the actual act of writing javascript.

DaveF said:
Thanks for the ideas. Basically I am trying to build a Tree structure with
multiple branches. It has LOTS of data. It is a skills matrix. I am woried
about it being slow. What is the best practice to code this. It almost seems
like old asp do while would be faster?

--


David Fetrow
Helixpoint LLC.
http://www.helixpoint.com
(e-mail address removed)
 
Back
Top