?
Solved

asp.net multview active

Posted on 2014-02-10
2
Medium Priority
?
854 Views
Last Modified: 2014-02-26
I try to get the active multiview. but it always return first one. I just want to know
the current active view. How can I do that?

<asp:MultiView ID="VehicleQuoteMV" runat="server" ActiveViewIndex="0">
 <asp:View ID="VehicleQuoteV1" runat="server" />
 <asp:View ID="VehicleQuoteV2" runat="server" />
 <asp:View ID="VehicleQuoteV3" runat="server" />
 </asp:MultiView>

   <%
             Response.Write("Active " & VehicleQuoteMV.GetActiveView.ID)
             
         
          %>
0
Comment
Question by:CoolDev2014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 2000 total points
ID: 39849253
hi.. You can do this using javascript

<script type="text/javascript">
    var CurrentView = <%= MultiView1.ActiveViewIndex %>
     alert("Current Active View Index Is :"+CurrentView);
</script>

if your MultiView is Inside the Update Panel then Code like below

<script type="text/javascript">
var CurrentView = <%=(UpdatePanel1.FindControl("MultiView1") as MultiView).ActiveViewIndex %>
alert("Current Active View Index Is :"+CurrentView);
</script>

Example

Code Behind

  protected void Page_Load(object sender, EventArgs e)
  {
    (UpdatePanel1.FindControl("MultiView1") as MultiView).ActiveViewIndex = 1;
  }

ASPX Code

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<script type="text/javascript">
var CurrentView = <%=  (UpdatePanel1.FindControl("MultiView1") as MultiView).ActiveViewIndex %>
alert("Current Active View Index Is :"+CurrentView);
</script>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
    <asp:MultiView ID="MultiView1" runat="server">
      <asp:View ID="View1" runat="server">
        View1
      </asp:View>
      <asp:View ID="View2" runat="server">
        View2
      </asp:View>
      <asp:View ID="View3" runat="server">
        View3
      </asp:View>
    </asp:MultiView>
  </ContentTemplate>
</asp:UpdatePanel>
</form>
0
 

Author Comment

by:CoolDev2014
ID: 39849508
it is using update panel, and I put below codes but it does not do anything. Regardless it page onload or after the button is clicked. It has nothing happened.

Thanks

<script type="text/javascript">
var CurrentView = <%=(UpdatePanel1.FindControl("MultiView1") as MultiView).ActiveViewIndex %>
alert("Current Active View Index Is :"+CurrentView);
</script>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question