Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:01:35+00:00 2026-05-23T13:01:35+00:00

I really didn’t know how to ask this question in a simple fashion. I

  • 0

I really didn’t know how to ask this question in a simple fashion.

I need to display a Client name on a page in several places and they’re not always visible at the same time.

The solution I originally had was 3 Label Controls (uxClientName1, uxClientName2 and uxClientName3) and I’d populate them in my code behind when I needed them.

uxClientName1 = CurrentClient.ClientName

A colleague suggested I use the following solution. On my page I would have this wherever I need it…

<%=DisplayClientName()%>

and in my code behind I would have this…

Protected Function DisplayClientName() As String

    Return CurrentClient.ClientName

End Function

This is great because it’s doing exactly what I want with no repeated code but I don’t really understand how it works or exactly what’s going on.

Any explanations?

EDIT: This is my Client Property on the page…

Private Property CurrentClient() As Client
    Get
        If ViewState("CurrentClient") Is Nothing Then
            '   No such value in view state, take appropriate action.
            ViewState("CurrentClient") = New Client
            Return CType(ViewState("CurrentClient"), Client)
        Else
            Return CType(ViewState("CurrentClient"), Client)
        End If
    End Get
    Set(ByVal value As Client)
        ViewState("CurrentClient") = value
    End Set
End Property
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:01:36+00:00Added an answer on May 23, 2026 at 1:01 pm

    These are embedded code blocks.

    Embedded code blocks must be written
    in the page’s default language. For
    example, if the page’s @ Page
    directive contains the attribute
    language=”VB”, the page will use the
    Visual Basic compiler to compile code
    in any script block marked with
    runat=”server” and any in-line code in
    <% %> delimiters.

    Embedded code blocks are supported in
    ASP.NET Web pages primarily to
    preserve backward compatibility with
    older ASP technology. In general,
    using embedded code blocks for complex
    programming logic is not a best
    practice, because when the code is
    mixed on the page with markup, it can
    be difficult to debug and maintain. In
    addition, because the code is executed
    only during the page’s render phase,
    you have substantially less
    flexibility than with code-behind or
    script-block code in scoping your code
    to the appropriate stage of page
    processing.

    Some uses for embedded code blocks:

    • Setting the value of a control or markup element to a value returned by a function
    • Embedding a calculation directly into the markup or control property.

    Here is a list of all inline ASP.NET tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i didn't really know how to title this question, but here's a thing that
I really didn't know what title to give this question, but I'll explain here:
really didn't want to ask this because I'm sure its simple but: I have
I really didn't want to have to waste people's time and ask this, but
Ok, I didn't really know how to even phrase the question, but let me
I really didn't want to ask for help as I know I'll eventually figure
Apologies if this has been asked before but I really didn't know what to
I got asked a question that I really didn't know how to answer. What's
Sorry for the title, I really didn't know how to say this... I often
This is almost a duplicate question, but I really didn't understand the answer given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.