Declaring a variable in aspx page and assigning the value in code behing ASP.Net

aresung

Newcomer
Joined
Oct 22, 2008
Messages
1
Developed a web application in ASP.Net (Framework 1.0), in which I have used public variable

which is defined in the aspx page and in the code behind will have some calculations and the

assign some value to that variable.

Example:
reports.aspx
.....
<TABLE cellSpacing="2" cellPadding="0" width="700" align="center">
<%=tstrHTML%>
</TABLE>
.....

reports.aspx.vb
private void displayReports()
{
tstrHTML = "<tr><td align=left>First Name</td>" & _
"<td align=left>Last Name</td>" & _
"<td align=left>Salary</td>"

tstrHTML += "<tr><td align=left>Binny</td>" & _
"<td align=left>Federal</td>" & _
"<td align=left>230000</td>"

}

The application was running fine for the last couple of years and all of a sudden having some

problem.

Can any one of you help me on figuring out this issue.

Thanks
 
What is the error message?

Nothing is being displayed in the table?

From the snippet you posted, I can tell you need to end your table rows....

"<td align=left>Salary</td></tr>"

"<td align=left>230000</td></tr>"

You didn't post the declaration of tstrHTML,but it should have a scope of at least Friend.
 
What is the error message?

Nothing is being displayed in the table?

From the snippet you posted, I can tell you need to end your table rows....

"<td align=left>Salary</td></tr>"

"<td align=left>230000</td></tr>"

You didn't post the declaration of tstrHTML,but it should have a scope of at least Friend.

Yep think you need to include the tstrHTML declaration and where displayReports is called.

As an aside both the </td> and </tr> tags are optional. You can save a bit of bandwidth by not including them. However, I always use them myself.
 
Optional? Blasphemy! In what html spec are you talking about, 4.01?

Welcome to the future, welcome to Xhtml.
 
Back
Top