J
JezB
I am a beginner in ASP.NET and web programming in general.
I have seen some examples on the internet in which some text set by
server-side code is "embedded" as a placeholder directly into client-side
html text (in the .aspx file). The syntax in the html text is, for example
:-
<p>Some client-side text and <%=ServerText%></p>
Now in the code-behind module (eg. c#) you can declare a public string
variable named ServerText and assign it to anything you like in Page_Load
and it seems to substitute it into the html stream, eg.
public string ServerText;
private void Page_Load(...)
{
if (!IsPostBack)
{
ServerText = "some server text";
}
}
Lo and behold when the page is rendered my paragraph reads :
Some client-side text and some server text
My questions are :
- what is the proper name for this mechanism ?
- what actually happens at run-time ?
- can anyone point me to some documentation on it (msdn or otherwise) ?
- does the string variable in the code-behind module have to be public ?
I have seen some examples on the internet in which some text set by
server-side code is "embedded" as a placeholder directly into client-side
html text (in the .aspx file). The syntax in the html text is, for example
:-
<p>Some client-side text and <%=ServerText%></p>
Now in the code-behind module (eg. c#) you can declare a public string
variable named ServerText and assign it to anything you like in Page_Load
and it seems to substitute it into the html stream, eg.
public string ServerText;
private void Page_Load(...)
{
if (!IsPostBack)
{
ServerText = "some server text";
}
}
Lo and behold when the page is rendered my paragraph reads :
Some client-side text and some server text
My questions are :
- what is the proper name for this mechanism ?
- what actually happens at run-time ?
- can anyone point me to some documentation on it (msdn or otherwise) ?
- does the string variable in the code-behind module have to be public ?