DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 14 Aug 2007 16:08:52 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    unknown
          2    unknown
          3    unknown
          4    Ross Culver
          5    unknown


Problem getting ActiveViewIndex   
My web form has a MultiView which has 4 Views.  4 LinkButtons on the
web form activates each of the 4 views.

The 4 views have been hiding and showing nicely depending upon which
LinkButton is clicked.

But, when I try to get the ActiveViewIndex when the [Submit] button is
clicked, I always get 0.  Or if I do

Multiview1.GetActiveView().ID;

I always get the name of the first view.

What is wrong?  I googled, but haven't found anyone experiencing this
problem yet.
Date:Tue, 14 Aug 2007 16:08:52 -0000   Author:  

Re: Problem getting ActiveViewIndex   
On Aug 14, 12:08 pm, "antonyliu2...@yahoo.com"
 wrote:

> My web form has a MultiView which has 4 Views.  4 LinkButtons on the
> web form activates each of the 4 views.
>
> The 4 views have been hiding and showing nicely depending upon which
> LinkButton is clicked.
>
> But, when I try to get the ActiveViewIndex when the [Submit] button is
> clicked, I always get 0.  Or if I do
>
> Multiview1.GetActiveView().ID;
>
> I always get the name of the first view.
>
> What is wrong?  I googled, but haven't found anyone experiencing this
> problem yet.


As a follow-up, I did set the active view index when a linkbutton is
clicked, like so:

MultiView1.ActiveViewIndex = 0; or
MultiView1.ActiveViewIndex = 1; or
MultiView1.ActiveViewIndex = 2; or
MultiView1.ActiveViewIndex = 3;
Date:Tue, 14 Aug 2007 16:11:21 -0000   Author:  

Re: Problem getting ActiveViewIndex   
On Aug 14, 12:08 pm, "antonyliu2...@yahoo.com"
 wrote:

> My web form has a MultiView which has 4 Views.  4 LinkButtons on the
> web form activates each of the 4 views.
>
> The 4 views have been hiding and showing nicely depending upon which
> LinkButton is clicked.
>
> But, when I try to get the ActiveViewIndex when the [Submit] button is
> clicked, I always get 0.  Or if I do
>
> Multiview1.GetActiveView().ID;
>
> I always get the name of the first view.
>
> What is wrong?  I googled, but haven't found anyone experiencing this
> problem yet.


Again, it is because of the postback ghost.

In Page_Load, I did

MutiView1.ActiveViewIndex = 0;

Wrapping it up with

if (!Page.IsPostBack)
{
  // That ghost line here.
}

Solves the problem.

Question: Does a page ALWAYS post back to itself when any button is
clicked?  On my web form I attempt to redirect to another page
through:

Response.Redirect("AnotherPage.aspx");

when the [Submit] button is clicked.

It looks like that the web form is posted back to itself, such that if
you don't do

if (!Page.IsPostBack)

, the ActiveViewIndex will again be set to 0.  Right?
Date:Tue, 14 Aug 2007 16:25:42 -0000   Author:  

Re: Problem getting ActiveViewIndex   
Have you tried storing the activeview in a session variable, updated each 
time the buttons are clicked?

Ross


 wrote in message 
news:1187107732.932473.58790@r34g2000hsd.googlegroups.com...

> My web form has a MultiView which has 4 Views.  4 LinkButtons on the
> web form activates each of the 4 views.
>
> The 4 views have been hiding and showing nicely depending upon which
> LinkButton is clicked.
>
> But, when I try to get the ActiveViewIndex when the [Submit] button is
> clicked, I always get 0.  Or if I do
>
> Multiview1.GetActiveView().ID;
>
> I always get the name of the first view.
>
> What is wrong?  I googled, but haven't found anyone experiencing this
> problem yet.
> 
Date:Tue, 14 Aug 2007 14:44:10 -0500   Author:  

Re: Problem getting ActiveViewIndex   
On Aug 14, 3:44 pm, "Ross Culver"  wrote:

> Have you tried storing the activeview in a session variable, updated each
> time the buttons are clicked?
>
> Ross
>
>  wrote in message
>
> news:1187107732.932473.58790@r34g2000hsd.googlegroups.com...
>
> > My web form has a MultiView which has 4 Views.  4 LinkButtons on the
> > web form activates each of the 4 views.
>
> > The 4 views have been hiding and showing nicely depending upon which
> > LinkButton is clicked.
>
> > But, when I try to get the ActiveViewIndex when the [Submit] button is
> > clicked, I always get 0.  Or if I do
>
> > Multiview1.GetActiveView().ID;
>
> > I always get the name of the first view.
>
> > What is wrong?  I googled, but haven't found anyone experiencing this
> > problem yet.


No, there is not need to do that now.
Date:Wed, 15 Aug 2007 20:20:00 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us