I have a multiline (> 50 lines) textbox containing plain text. I want to add either a session variable to the text in this box. In asp I would have done it by putting in <% %> code blocks but in .net I am getting the following error: “Code blocks are not supported in this context”. I assume therefore that this would need doing in code behind.
Is there a quicker way than putting all the text from the textbox in a string in code-behind and then adding the variable on like this? I would like to keep the text in my aspx page if possible.
Thanks
How about your codebehind does something like:
after you’ve filled the textbox.
Incidentally, you don’t have to
as the .Net framework exposes all the front-end controls as codebehind objects automatically.
EDIT:
This will work for binding just the session variable to the control. Don’t forget to call
after you’ve set your Session variables. Probably in
Page_Load.This will allow the binding such as it is, to occur. This won’t work if you want to mix up static markup text with dynamic variables. For that, you’ll need to get busy in the code-behind.
HTH.