•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 375,198 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,036 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 476 | Replies: 3
![]() |
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I have a multiview inside a form view. The multiview active index is based on a dropdownlist selection, I found out that I need to put this line somewhere:
My page has a masterpage, so the main page looks like this:
I have had people suggesting me to put it in the vb file like this:
I tried putting the sub inside FormView, inside Edit Template, inside master file....
Anywhere I put it, same error:
name mv not declared....
Please help me, where can I put it, or how can I achieve what I need to do?
Thank you for your time!!!
vb Syntax (Toggle Plain Text)
<script runat="server"> Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) MultiView2.ActiveViewIndex = DropDownList1.SelectedValue End Sub </script>
My page has a masterpage, so the main page looks like this:
vb Syntax (Toggle Plain Text)
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" title="test" %> <asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server"> <asp:FormView ID="FormView1" runat="server" DataSourceID="sdsDetail" DefaultMode="Edit"> <EditItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Active") %>' AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem Value=""></asp:ListItem> <asp:ListItem Value="A">Active Employee </asp:ListItem> <asp:ListItem Value="R">Retired</asp:ListItem> </asp:DropDownList> <asp:MultiView ID="MultiView2" runat="server"> <asp:View ID="View1" runat="server"> <asp:ListBox ID="ListBox1" runat="server" DataSourceID="odsDept" DataTextField="Dept_name" DataValueField="Dept_name" SelectedValue='<%# bind("Dept") %>' Width="232px"> </asp:ListBox><asp:ObjectDataSource ID="odsDept" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDept" TypeName="TableAdapters.A_TableAdapter"></asp:ObjectDataSource> </asp:View> <asp:View ID="View2" runat="server"> <asp:ListBox ID="ListBox2" runat="server" DataSourceID="odsB" DataTextField="Group_Name" DataValueField="Group_Name" SelectedValue='<%# bind("Dept") %>' Width="232px"> </asp:ListBox><asp:ObjectDataSource ID="odsB" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetGroup" TypeName="TableAdapters.B_TableAdapter"></asp:ObjectDataSource> </asp:View> </asp:MultiView> </EditItemTemplate> </asp:FormView> </asp:Content>
I have had people suggesting me to put it in the vb file like this:
Partial Class list_pages_Details
Inherits System.Web.UI.Page
'Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
' dim MultiView mv
' dim DropDownList ddl
' mv = (MultiView)FormView1.FindControl("MultiView2")
' ddl = (DropDownList)FormView1.FindControl("DropDownList1")
' mv.ActiveViewIndex = ddl.SelectedValue
'End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
End ClassI tried putting the sub inside FormView, inside Edit Template, inside master file....
Anywhere I put it, same error:
name mv not declared....
Please help me, where can I put it, or how can I achieve what I need to do?
Thank you for your time!!!
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I did, and it complaints
1. end of statement expected.
2. mv, ddl is not declared...
any suggestions? thank you.
my VB file looks like:
vb Syntax (Toggle Plain Text)
Partial Class test Inherits System.Web.UI.Page Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) dim mv as MultiView = (MultiView)FormView1.FindControl("MultiView2") dim ddl as DropDownList = (DropDownList)FormView1.FindControl("DropDownList1") mv.ActiveViewIndex = ddl.SelectedValue End Sub End Class
Last edited by s627y : Mar 19th, 2008 at 2:08 pm.
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I got it fixed, thank you!
looks like:
looks like:
vb Syntax (Toggle Plain Text)
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim mv As MultiView = FormView1.FindControl("MultiView2") Dim ddl As DropDownList = FormView1.FindControl("DropDownList1") mv.ActiveViewIndex = ddl.SelectedValue End Sub
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
- insert and update query (VB.NET)
- Couple of errors in my code (Java)
- site will not display php, only the code contents (PHP)
- code tags (DaniWeb Community Feedback)
- WizardSteps-> SQL Insert -> Grab ID field (ASP.NET)
- How to make windows form from c++ code (GUI) (C++)
- need help with insert.php (PHP)
- Setting a variable to the Exit Code (Python)
- I am trying to get this code to work. Please help. (C++)
Other Threads in the ASP.NET Forum
- Previous Thread: Open a file using asp.net
- Next Thread: problems about content page and master page


Linear Mode