473,848 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamically generate multiView Problem

Hi friends,

I am very sorry for my not perfect English.

I have one question, I am using David Bauer's DynamicControls Placeholder to
dinamically generate controls and I am tryig to generate MultiViev, at first
it working, when I click btn1 I set SetActiveView to viev1 and it's working
OK, but when after that I click btn2 and try to set SetActiveView to 2, I
receive this error:

ActiveViewIndex is being set to '1'. It must be smaller than the current
number of View controls '0'. For dynamically added views, make sure they are
added before or in Page_PreInit event.
Parameter name: value

Please help me to understand this error

This is my code

Aspx file:

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="test. aspx.vb"
Inherits="test" title="Untitled Page" %>

<%@ Register Assembly="DBaue r.Web.UI.WebCon trols.DynamicCo ntrolsPlacehold er"
Namespace="DBau er.Web.UI.WebCo ntrols"

TagPrefix="DBWC " %>

<html >

<head id="Head1" runat="server">

<title>Untitl ed Page</title>



<form id="sad" runat=server>

<dbwc:dynamicco ntrolsplacehold er id="DynamicCont rolsPlaceholder 1"

controlswithout ids="Persist"></dbwc:dynamiccon trolsplaceholde r>

<br />

<br />

<asp:Button ID="btn1" runat="server" Text="first click here" />

<asp:Button ID="btn2" runat="server" Text="then click here" />




Vb file:

Partial Class test

Inherits System.Web.UI.P age

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load

If Not Page.IsPostBack Then

Dim m As New MultiView

DynamicControls Placeholder1.Co ntrols.Add(m)

Dim i As Integer

Dim v As View

For i = 0 To 5

v = New View


v.ID = "MyView" & i

Dim txt As New TextBox

v.Controls.Add( txt)

txt.ID = "txt" & i

txt.Text = "My text " & i


End If

End Sub

Protected Sub btn1_Click(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles btn1.Click

DirectCast(Dyna micControlsPlac eholder1.Contro ls(0),
MultiView).SetA ctiveView(Direc tCast(DynamicCo ntrolsPlacehold er1.Controls(0) ,
MultiView).View s(1))

End Sub

Protected Sub btn2_Click(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles btn2.Click

DirectCast(Dyna micControlsPlac eholder1.Contro ls(0),
MultiView).SetA ctiveView(Direc tCast(DynamicCo ntrolsPlacehold er1.Controls(0) ,
MultiView).View s(2))

End Sub

End Class

May 7 '06 #1
0 3426

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Fabuloussites | last post by:
I have a page that has multiview control that has two dropdown lists on it. the dropdown controls ARE NOT inside of the multiview. Each drop down is bound using its own sqldatasource conrtol. The multiview is declared below the dropdown controls on another portion of the page. so, here is the progression.. 1) select a category from drowdown one that is bound using sqldatasource1 2) dropdown2 is populated based on selection or...
by: Dianna | last post by:
Hi, I have a multiview that consists of 2 views. I am trying to put to buttons on the top so that the user can toggle between views. Problem: There does not seem to be any absolute positioning on the multiview and the controls from View1 and View2 are on top of the toggle buttons. Is there any way of controlling where the Multiview controls goes on the page? Thanks,
by: Cetin | last post by:
Hi, I have a problem with the MultiView control. Hopefully you can help me. I made a asp page with a MultiView on it. The MultiView has three views (with some controls). I made a method that programmatically removes one of the views: MultiView1.Views.Remove(View2); But when the page Postbacks, all three views are back. So is this a bug or is it intended to reappear every time the page loads? In latter case, on
by: TMT32 | last post by:
Hi, I try to add multiview in datalist, but how to change multiview's default view page in datalist? Where it is ? datalist1.itemtemplates.itemtemplates.multiview ?? thanks TMT32
by: veerleverbr | last post by:
Hi, I want to create an asp.net page with a tabpage. On the tabpage I want to use the WebDateChooser and WebDataInput controls of Infragistics. These 2 controls use a mask to enter a date and bankaccountnummber, so that no invalid date or bankaccountnumber can be inputted. I started out with the tabcontrol of infragistics. But I also want to use the atlas update panel, and this gives conflicts when used together with the infragistics...
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
by: cvijaykrishna | last post by:
i am having a web based application and i am having a problem with it pls check it Explanationi am sending a sample code plese see it in VS-2005 FOR BETTER UNFERSTANDING I have a main page called DEFAULT.ASPX it has a drop down list and 3 contentplace holders dropdown list With 3 parameters A,B,C if i select any options in drop down list the respective Content place holder will add respective user control and get Visible. for...
by: Nathan Sokalski | last post by:
When I include a MultiView control in my application, I receive the following error: MultiView cannot have children of type 'Label'. It can only have children of type View. I receive the same error (with 'Label' replaced with another control type) when I use other control types as well. The only type of control that is an immediate child of my MultiView control is View. The basic layout of my MultiView control is:
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer row. I would like to display the footer row, only when a LinkButton "Add New" is clicked. And after the new record is saved to the database, let the footer row disappear. In the LinkButton's click event handler, I simply say:
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.