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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:02:20+00:00 2026-05-23T09:02:20+00:00

The example looks a bit long. But it is necessary to understand my question.

  • 0

The example looks a bit long. But it is necessary to understand my question.

if (IsPostBack)

    {

            for (int j = 0; j < PostsDic.Count; j++)//The number is 2. 2 buttons to be created.
            {
                Button pgs2 = new Button();//Create New Topic
                pgs2.Width = 20;
                pgs2.Command += obtainTopicsPerPage_Click;
                pgs2.EnableViewState = false;
                pgs2.CommandName = j.ToString();
                pgs2.Text = j.ToString();
                buttons.Add(pgs2);

            }
            if (!FirstList)
            {
                ListFirstPage();//Creates a few tables and makes it look like a thread table in a forum
                FirstList = true;
            }



    }

Additional information:

FirstLoad is simply a prop:

public bool FirstList { get { return ViewState["first"] == null ? false : (bool)ViewState["first"]; } set { ViewState["first"] = value; } }

ListFirstPage() method looks like this:

    void ListFirstPage()
{
    //Dictionary<int, List<AllQuestionsPresented>>
    foreach (var item in PostsDic)
    {

       foreach (var apply in PostsDic[item.Key])
       {
          DisplayAllQuestionsTable objectToList = new DisplayAllQuestionsTable(this, apply.Name, apply.ThreadName, apply.Topic, apply.Subtopic, apply.Views, apply.Replies, apply.PageNumber, apply.Time, PlaceHolder2);
          objectToList.ExecuteAll();
       }

    }

The button event looks like this:

enter code here   void obtainTopicsPerPage_Click(Object sender, CommandEventArgs e)
{
    //Dictionary<int, List<AllQuestionsPresented>>
    foreach (var item in PostsDic)
    {
        if (item.Key.ToString() == e.CommandName)
        {
            int ds=0;

            foreach (var apply in PostsDic[item.Key])
            {
                DisplayAllQuestionsTable objectToList = new DisplayAllQuestionsTable(this, apply.Name, apply.ThreadName, apply.Topic, apply.Subtopic, apply.Views, apply.Replies, apply.PageNumber, apply.Time, PlaceHolder2);
                objectToList.ExecuteAll();

            }
        }
    }

What happens is this.. When I click a button that i have on the form the ListFirstPage() is triggered, this leads to a list of tables being listed, and a page bar (2 buttons with numbers on them i.e. 1 ,2). When i press button 2 i expect the iteration inside the button event to happen/ But instead, nothing happens the form goes blank and nothing is generated. Why is that? Note that the algorithm in the ListFirstPage and the buttons events is identical!!!!

  • 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-23T09:02:21+00:00Added an answer on May 23, 2026 at 9:02 am

    Don’t forget you must re-create all dynamic controls on postback

    Your Page is just a class remember and it is instantiated once per request, if it doesn’t recreate these controls as well as the associated handlers on the postback request then you won’t get anything happen..

    You need to recreate these controls prior to Page_Load, you can do this in Page_Init or override the CreateChildControls method.

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

Sidebar

Related Questions

Example: http://bit.ly/dfjvmT If you take a look at that URL, you will see an
HI I have an example document that looks like <ItemEntry> <PurchaseDate>2010-03-18T20:36:32.81108+13:00</PurchaseDate> <StoreGUID>0a0324ad-5f99-486a-a2d0-870bc6991e9f</StoreGUID> <ExpiryDate />
I've got some XML, for example purposes it looks like this: <root> <field1>test</field1> <f2>t2</f2>
I have a PHP array which looks like this example: $array[0][0] = 'apples'; $array[0][1]
I have a data file that looks like the following example. I've added '%'
I have a page, URI looks like this: http://domain.example.com/Profiles/Profile.aspx?username=blah#blahtab When that fragment (#blahtab) is
I have created simple example with @Singleton, @Schedule and @Timeout annotations to try if
Similar to this question , but I have one master report which contains many
I'm writing a Fixedpoint class, but have ran into bit of a snag... The
Ok, I've searched quite a bit, but seem unable to find an answer or

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.