Not Showing Large Part Of the Page

Discussion in 'ASP .Net' started by Ed West, Aug 23, 2004.

  1. Ed West

    Ed West Guest

    Hello

    What is the proper way in ASP.Net to not show large parts of the page?
    For example, if I was showing a record detail page, if the record id
    does not exist or they don't have rights to see it, I would just show an
    error message and NOT show the rest of the html for the all the fields
    in the record. And if possible still be able to use the designer to
    place the labels and data, etc. In ASP I would do something like:

    <%
    if (rs.eof and rs.bof) Then
    Response.Write "record id " & rs("id") & " does not exist"
    Else NOT HaveRights(rs("id")) Then
    Response.Write "YOu do not have rights to see this record."
    Else
    %>
    <table>
    <tr><td>First Name:</td><td><%=rs("first_name")%></td></tr>
    <tr><td>Last Name:</td><td><%=rs("last_name")%></td></tr>
    .. . . .

    <% End If
    %>

    Thanks,

    -dan
    Ed West, Aug 23, 2004
    #1
    1. Advertising

  2. Ed West

    PL Guest

    Use a placeholder around your controls and set the Visible property to false.

    If you want to filter individual records from appearing when you
    databind to something you probably have to filter it in the sql.

    PL.

    "Ed West" <> wrote in message news:...
    >
    > Hello
    >
    > What is the proper way in ASP.Net to not show large parts of the page? For example, if I was showing a record detail page, if the
    > record id does not exist or they don't have rights to see it, I would just show an error message and NOT show the rest of the html
    > for the all the fields in the record. And if possible still be able to use the designer to place the labels and data, etc. In
    > ASP I would do something like:
    >
    > <%
    > if (rs.eof and rs.bof) Then
    > Response.Write "record id " & rs("id") & " does not exist"
    > Else NOT HaveRights(rs("id")) Then
    > Response.Write "YOu do not have rights to see this record."
    > Else
    > %>
    > <table>
    > <tr><td>First Name:</td><td><%=rs("first_name")%></td></tr>
    > <tr><td>Last Name:</td><td><%=rs("last_name")%></td></tr>
    > . . . .
    >
    > <% End If
    > %>
    >
    > Thanks,
    >
    > -dan
    PL, Aug 23, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tor Inge Rislaa

    Showing an HTML file in part of a Webform

    Tor Inge Rislaa, Aug 2, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    330
  2. Ray Booysen
    Replies:
    2
    Views:
    643
    Ray Booysen
    Mar 28, 2006
  3. Arbajram

    Showing only first part of the field in datagrid

    Arbajram, Jun 15, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    107
    Arbajram
    Jun 17, 2004
  4. Tor Inge Rislaa

    Showing an HTML file in part of a Webform

    Tor Inge Rislaa, Aug 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    96
    Jim Cheshire [MSFT]
    Aug 5, 2003
  5. Jack
    Replies:
    8
    Views:
    274
Loading...

Share This Page