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

  • Home
  • SEARCH
  • 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 6816549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:56:21+00:00 2026-05-26T20:56:21+00:00

I need to get a label during runtime so that i can compare to

  • 0

I need to get a label during runtime so that i can compare to the Session[“userName”] and choose to show buttons after the comparison.
I have look around and this seems to be the solution but i’ve run onto trouble as i only get null during runtime.

UserName:
            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
            <br />

So, this is the label inside a “ListView1” i need what Eval finds during each iteration of pumping out of the attached database.

    <% Label lbl = (Label) ListView1.FindControl("userName");
       string userName = lbl.Text;
        if (Session["userName"].ToString() == userName)
        {%>
    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
    <% }%>

and this is my attempt at retrieving the label.Text. i know it is something similar to this but i might be doing it wrong… well i am doing it wrong.

Thanks you very much for any information you can provide as i have just spent about 10 hours changing the ways i could achieve this result.

  • 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-26T20:56:22+00:00Added an answer on May 26, 2026 at 8:56 pm

    I would do something like:

    Visible='<%# Session["userName"].ToString() == Eval("UserName").ToString() %>'
    

    on each of the Button controls.

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

Sidebar

Related Questions

I need to have a toolstrip label and its back color changed during runtime,
I have Labels inside a Canvas, I need to get the label that intersects
Need to get the 10 word before and 10 words after for the given
I need to get some information that is contained in the MFT on a
I have a label, which contains text. I need to get the two text
Im wondering how to get a label control that is in a header template
I have a div that is being duplicated dynamically. After duping it, I need
Possible Duplicate: Get column index from label in a data frame I need to
Just need get some vals located in application.ini(main ini) in the Controller plugin I
I need get all items these have no categories int? categoryId = null; var

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.