How to access data binding object in aspx page in ASP.NET?

Posted by weilin8 on Stack Overflow See other posts from Stack Overflow or by weilin8
Published on 2010-12-28T21:52:56Z Indexed on 2010/12/29 2:54 UTC
Read the original article Hit count: 176

Filed under:
|

I am trying to hide or show a certain section of my table depending on the value of a property in my binding object(s).

public class Class1
{
    public bool Display { get; set; }
}

In ASP.NET MVC, I can just do the following (assuming that Class1 is the model that binds to the page.)

<table>
    <tr>Row 1</tr>
    <tr>Row 2</tr>
    <% if(Model.Display) { %>
    <tr>Row 3</tr>
    <tr>Row 4</tr>
    <% } %>
</table>

How can I achieve the same behavior in transitional ASP.NET? That "Model" variable is not available. How do I retrieve the data binding object? Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET