Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I am developing a module for dotnetnuke;

In my ascx file, I have something similar to this:

ASP.NET
<asp:panel>
    <asp:btn1>
    <asp:btn2>
    <asp:multiview>
 
    <view1>
    <controls with autopostBack />
    </view>
 
    <view2>
       </view>
       </multiview>
</panel>


On page.init, I use ajax.wrapupdatepanelcontrol on the panel; using btn1 and btn2, I select one of the views.

The problem is that, when I trigger another control, the currently selected view is reset, as if the selected view index is not mantained across postbakcs; obvusly, not wrapping the panel, everything works fine.

Is there an option or something to keep the selected page "automatically"?

The solution that comes to my mind is:

1 - save somewhere the selectedViewIndex;
2 - at each postBack, during pageLoad, check the stored value and set the activeView

Just would like to know if there's some better solution..

Thank you in advance,

Alberto

[EDIT]

For now, I solved that way..

when I activate a specific view, i also store its index in a a viewstate variable; than, during pageLoad, I check the value and re-set the multiview with the correct viewindex


VB
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 multiView.ActiveViewIndex = ViewState("MyVar")
End Sub

protected sub selectView(byval index as int)
   multiView.ActiveViewIndex = index
   ViewState("MyVar") = index
end sub
Posted
Updated 16-Sep-11 3:41am
v5
Comments
Herman<T>.Instance 16-Sep-11 6:49am    
if (!Page.IsPostBack) ??
Alberto Biasiutti 16-Sep-11 9:34am    
Maybe the question wasn't clear.. The fact is that I don't do anithing to that poor multiview during post..
without wrapping the panel, even during postBacks, the current view remains selected; If I wrap the panel, it doesn't..

I'll update the question with the solution I adopted for now

1 solution

write
C#
Multiview1.ActiveViewIndex=0;

after every event programing in the View
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900