how to build a url by getting the parameter from the behind code file?
Suppose I have a page named:test.aspx
,and a behind code file test.aspx.cs
.
Now ,inside the test.aspx,there is a frame whose "src" attribu开发者_如何学Pythonte is dynamic:
<iframe src="anotherPage.aspx?id=<%=id%>" xxx>
the id parameter is to be explosed by the cs file Then in the cs:
I have a protected field named id:
protected strin id;
But it seems that it does not work?
What is going on?
When using expressions in ASP .NET, it is always advisable to use properties instead of public fields.
With auto-implemented properties things are even simpler in C#.
See if the following helps:
<iframe src="anotherPage.aspx?id=<%= ID %>" xxx>
and the code behind declaration would be:
public string ID { get; set; }
"protected strin id";
should be
public string id;
精彩评论