Send output to specific panel

  • Thread starter Thread starter ChrisC
  • Start date Start date
C

ChrisC

Hello all, I'm a bit of an ASP.NET / C# noob so bear with me.

In my codebhind I have taken some data and based on that data I have
some javascript to post back to my page. The javascript is in the
string variable "BottomCode".

I need to post the contents of the BottomCode file inside a particular
Panel on my page but I'm not sure how to do it. I tried writing it to
a lable but found that #1 you cant have newlines in a label and #2 it
encapsulated my javascript code with SPAN tags.

How can I do this?

Thanks!
Chris
 
Chris,

Do you mean you actually have to have the Javascript embedded in the
page (and not displayed)? If so, then why not just use Response.Write at
the point you want the script block inserted?
 
Hi,

ChrisC said:
Hello all, I'm a bit of an ASP.NET / C# noob so bear with me.

Then you better post in the ASPNET NG.
In my codebhind I have taken some data and based on that data I have
some javascript to post back to my page. The javascript is in the
string variable "BottomCode".

Do not understand that, how you send it to the client?
And how the client execute it?
I need to post the contents of the BottomCode file inside a particular
Panel on my page but I'm not sure how to do it. I tried writing it to
a lable but found that #1 you cant have newlines in a label and #2 it
encapsulated my javascript code with SPAN tags.

Is BottomCode a file or a variable?

If you want to dump a file you can use a Literal control and place it inside
the Panel
 
Sorry, I should have been more clear. I used some code in my
CodeBehind file to write information to a variable named BottomCode.

What I need to send back to the page is:

<script type="text/javascript">
<!--
SET_DHTML("frame1", "frame2");

//-->
</script>

where frame1, frame 2 etc was some data I got earlier in my
CodeBehindfile. Now i have the above script code in the variable
BottomCode and I need to write it back to the browser. Forget the
part about the Panel...it doesn't have to go inside a panel or label,
I just need to figure out a way to write this back to the page before
the </BODY> tag.

I tried this:
Response.Write(BottomCode);

But this writes the script at the top of the HTML above the doctype
and everything. i need it to write in the <BODY></BODY> area.

Hope I'm making sense here. This is all still a bit new to me.

-Chris
 
Then you need to use ScriptManager.RegisterClientScriptBlock
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top