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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:16:02+00:00 2026-05-17T01:16:02+00:00

I have the following structure <asp:UpdatePanel ID=MyUpdatePanel runat=server> <ContentTemplate> <asp:MultiView ID=MyViews runat=server> <asp:View ID=List

  • 0

I have the following structure

<asp:UpdatePanel ID="MyUpdatePanel" runat="server">
    <ContentTemplate>
        <asp:MultiView ID="MyViews" runat="server">
            <asp:View ID="List" runat="server">
                <asp:Repeater runat="server" ID="Repeater1">
                    <ItemTemplate>
                        <asp:LinkButton ID="Button1" runat="server" Text="Button1" CommandName="View" />
                    </ItemTemplate>
                </asp:Repeater>
            </asp:View>
            <asp:View ID="Single" runat="server">
                <asp:LinkButton ID="Button2" runat="server" Text="Button2" />
            </asp:View>
        </asp:MultiView>
    </ContentTemplate>
</asp:UpdatePanel>

On the code behind I get the repeater ItemDataBound event, get the control using var button1 = e.Item.FindControl("Button1") as LinkButton; then I assign a CommandArgument with the ID of the current element.

This is being executed immediately after the CreateChildControls method.

Repeater1.ItemDataBound += (s, e) =>
{
    if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
    {
        var Button1 = e.Item.FindControl("Button1") as LinkButton;
        Button1.CommandArgument = item.ID.ToString();
    }
};

Repeater1.ItemCommand += (s, e) =>
{
    if (e.CommandName == "View")
    {
        var item = provider.Get(Convert.ToInt64(e.CommandArgument));
        BuildSingleView(item);
    }
};

This method just change the view…

public void BuildSingleView(var item)
{
    MyViews.ActiveViewIndex = 1;
    /* Edit
       I've tried to call here
       Initialize(), EnsureChildControls(), CreateChildControls()
       but it was a useless try. I also tried to catch exceptions,
       but none happened.
     */
}

The problem is that the view doesn’t change. When I click the LinkButton it executes the CreateChildControls and after it calls the event ItemCommand, the event calls the BuildSingleView, the ActiveViewIndex is changed but nothing happens on the page.

I don’t understand why it doesn’t change. Is it a problem with the order of events? What could I do to change the view when I click a LinkButton?


Here is the full code-behind code (the Initialize method is the method that executes immediately after CreateChildControls) http://pastebin.com/2qwrKNxf

And here the full ascx file http://pastebin.com/P8RSbY9U

  • 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-17T01:16:03+00:00Added an answer on May 17, 2026 at 1:16 am

    I figured out that when the update panel posts back it doesn’t call the event handler first. So in order to get it to execute I need to re-assign the event.

    My problem was that the control wasn’t saving the ViewState, so it kept creating the wrong events. I replaced the ViewState with a Session and I got the behavior I wanted.

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

Sidebar

Related Questions

I have following HTML structure : <asp:TextBox ID=txtFrom class=textBox js-min runat=server /> <asp:RequiredFieldValidator ID=strtDtValidator
I have the following structure in an aspx page: <asp:Panel ID=pnlCust runat=server> <asp:GridView ID=gvMaster
I have the following ASPX structure: <UpdatePanel id=OutsidePanel UpdateMode=Conditional> <div runat=server id=myDiv> <UpdatePanel id=InsidePanel
Hi guys we have following structure in one of our project's pages: <asp:UpdatePanel ID=up1
I'm using ASP.NET MVC2 and I have the following object structure: public class IDealer
I have created the following project structure for my new asp.net mvc project any
I have an asp:table(table1), in a user control with following structure | Col2 |
We have a Asp.net webforms webapplication. The solution has the following structure: MySolution\ MySolution.Main\
In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have following data structure (simplified): A giant list of the class TestClass public

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.