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 277543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:05:39+00:00 2026-05-12T01:05:39+00:00

I have the following code: public partial class queryTerm : System.Web.UI.UserControl { private static

  • 0

I have the following code:

   public partial class queryTerm : System.Web.UI.UserControl
    {
        private static readonly List<string> BooleanOperators = new List<string> { ".", "AND", "AND NOT", "OR", "OR NOT" };

        protected void BuildBoolPanel()
        {
            var parensOpen = _labelBoolean.Text;
            foreach (var @operator in BooleanOperators)
            {
                if (parensOpen == @operator)
                {
                    continue;
                }

                var linkButton = new LinkButton();
                linkButton.Text = @operator;
                linkButton.CommandArgument = @operator;
                linkButton.CommandName = "parensOpen";
                linkButton.Command += new CommandEventHandler(linkButton_Command);
                _popupMenuParensOpen.Controls.Add(linkButton);
                var literalLineBreak = new Literal();
                literalLineBreak.Text = "<BR/>";
                _popupMenuParensOpen.Controls.Add(literalLineBreak);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
                BuildBoolPanel();
        }

        void linkButton_Command(object sender, CommandEventArgs e)
        {
            _labelBoolean.Text = (string)e.CommandArgument;
            BuildBoolPanel();
        }
    }

I have a panel(it’s _popupMenuParensOpen) that is shown with the hoverextender whenever the cursor finds itself over a specific label in my user control.

This panel has all the boolean operators and ‘.’ meaning not set.
I programatically add the boolean operators as a label in my panel, and I only add those that don’t match what it is currently set to. For instance if my label is set to ‘AND’, when I hover over it, I display everything but ‘AND’.

The problem is these never call linkButton_Command even though I instruct them to.
Weirder yet, if I remove the ‘if (!this.IsPostBack) in page load, it will call it.

My control is inside an updatePanel.

  • 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-12T01:05:39+00:00Added an answer on May 12, 2026 at 1:05 am

    The issue is that you’re dynamically adding the controls during the Page_Load event. When a postback occurs those controls aren’t going to exist and will need to be created every time. This is why when you remove your if (!Page.IsPostBack), and the controls are rebuilt, it works.

    Since you’re building this as a user control, you might want to look in to overriding the CreateChildControls method.

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

Sidebar

Ask A Question

Stats

  • Questions 128k
  • Answers 128k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The longest functions that I have ever written all have… May 12, 2026 at 5:38 am
  • Editorial Team
    Editorial Team added an answer If you use SSIS, you can redirect the Error Output… May 12, 2026 at 5:38 am
  • Editorial Team
    Editorial Team added an answer Try adding a single call to Randomize Timer before you… May 12, 2026 at 5:38 am

Related Questions

I have the following code. I build a grdiview programamtically then I go through
I'm using the lastest version of Silverlight 2.0 within Visual Studio 2008. I have
I have a user control which contains a textbox. I have a class called
I'm using WPF within Visual Studio 2008. I have a simple WPF UserControl with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.