Postback issue for my user load configuration wizard

I have some problem that occurs when the controls load in init, and this still does not help me get the proper postback event fired on time.

I'm trying to create a rich wizard control that will include switching, description links, fully customizable steps, integrating sub-steps - with a dynamic control load that avoids the usual asp.net loading method.

The idea is to have on the left side of the navigation, on the right-hand side of the part or substep, which are launched from the right side and which pass through the entire area.

Download Source Project

0
source share
2 answers

Ok, I'm re-reading the question, and here is what you need to do. You must reload these controls with every postback, always give them the same identifier. This can be done in Page_Init or in the Page_Load event. And, of course, you need to reattach event handlers on each column.

0
source

Thank you very much .. well, I found the answer - id was the problem in the load management method. I did this wizard. Well, a lot works now. If anyone is interested to see how this works, there are some updates:

public void LoadSplitViewControl(string path)
{
    SwitchNavigationView(NavigationView.SplitView);
    LastNavigationView = NavigationView.SplitView;
    LoadControl(SplitControlLoader, path, "LoadedControlSplit");
}

public void LoadSingleViewControl(string path)
{
    SwitchNavigationView(NavigationView.SingleView);
    LastNavigationView = NavigationView.SingleView;
    LoadControl(SingleControlLoader, path, "LoadedControlSingle");
}

public void LoadSingleViewControlAsClear(string path)
{
    SwitchNavigationView(NavigationView.SingleView);
    LastNavigationView = NavigationView.SingleView;
    LoadControlAsClear(SingleControlLoader, path, "LoadedControlSingle");
}

private void LoadControl(PlaceHolder holder, string path, string ID)
{
    UserControl ctrl = (UserControl)Page.LoadControl(path);
    ctrl.ID = ID;
    LastControlPath = path;
    holder.Controls.Clear();
    holder.Controls.Add(ctrl);
}

// , splitview , , viewstate , , LoadSingleViewControlAsClear, .

private void LoadControlAsClear(PlaceHolder holder, string path, string ID)
{
    UserControl ctrl = (UserControl)Page.LoadControl(path);
    ctrl.ID = ID;
    LastControlPath = path;
    ctrl.EnableViewState = false;
    holder.Controls.Add(ctrl);
}

/ , , , viewstate, , . pageguid - , . /

public Guid PageGuid
{
    get
    {
        if (PageGuidField.Value == "")
        {
            var _pageGuid = Guid.NewGuid();
            PageGuidField.Value = _pageGuid.ToString();
            return _pageGuid;
        }
        return new Guid(PageGuidField.Value);
    }
}
0

Source: https://habr.com/ru/post/1710489/


All Articles