| | |
Where to insert this code?
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
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:
ASP.NET Syntax (Toggle Plain Text)
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 Class
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!!!
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
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:
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 3:08 pm.
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
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
![]() |
Similar Threads
- need help with insert.php (PHP)
- 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++)
- 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
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net box browser button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose fileuploader fill flash form formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio ratings redirect registration relationaldatabases reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking typeof unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





