Hello All,
I have a UserControl wwhich consists of one Label and one DropDownList
control. I have written a Public methofd to allow me to set the Label's Text
property and populate the dropdownlist with listitems. Here's the code:
Public Sub PopulateDropDow nList(ByVal ListCaption As String, ByVal
ListItems As XmlNode)
Label1.Text = ListCaption
Dim Items As XmlNodeList = ListItems.Selec tNodes("Items/Item")
For Each Item As XmlNode In Items
Dim li As New ListItem
li.Value = Item.Attributes ("id").Value
li.Text = Item.Attributes ("value").Va lue
DropDownList1.I tems.Add(li)
Next
End Sub
I would like to call this from my webform by writing:
Dim UControl As UserControl =
CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"), UserControl)
UControl.Popula teDropDownList( "Recipient' s Name:", RecipientNamesN ode)
This doesn't work. The PopulateDropDow nList doesn't appear in the
intellisense list. What appears in the list are the properties and methids
of a UserControl (as anyone would expect).
How can I do this? I know that it's possible; I just can't think of a way
how.
Does anyone know of a good online reference for coding UserControls?
TIA,
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation 3 1420
It looks like you need to Dim your UControl as the specific object you are
loading.. in other words:
Dim UControl As AugmentedDropDo wnList =
CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"),A ugmentedDropDow nList)
Because intellisense looks to see what kind of object you have loaded - and
it thinks you just loaded an object of type UserControl - and you need to be
clear that it is an object of type AugmentedDropDo wnList.
HTH
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:01******** *************** ***********@mic rosoft.com... Hello All,
I have a UserControl wwhich consists of one Label and one DropDownList control. I have written a Public methofd to allow me to set the Label's Text property and populate the dropdownlist with listitems. Here's the code:
Public Sub PopulateDropDow nList(ByVal ListCaption As String, ByVal ListItems As XmlNode) Label1.Text = ListCaption Dim Items As XmlNodeList = ListItems.Selec tNodes("Items/Item") For Each Item As XmlNode In Items Dim li As New ListItem li.Value = Item.Attributes ("id").Value li.Text = Item.Attributes ("value").Va lue DropDownList1.I tems.Add(li) Next End Sub
I would like to call this from my webform by writing:
Dim UControl As UserControl = CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"), UserControl)
UControl.Popula teDropDownList( "Recipient' s Name:", RecipientNamesN ode)
This doesn't work. The PopulateDropDow nList doesn't appear in the intellisense list. What appears in the list are the properties and methids of a UserControl (as anyone would expect).
How can I do this? I know that it's possible; I just can't think of a way how.
Does anyone know of a good online reference for coding UserControls?
TIA, -- Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Dim UControl As AugmentedDropDo wnList=
CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"),
AugmentedDropDo wnList)
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Joe" wrote: Hello All,
I have a UserControl wwhich consists of one Label and one DropDownList control. I have written a Public methofd to allow me to set the Label's Text property and populate the dropdownlist with listitems. Here's the code:
Public Sub PopulateDropDow nList(ByVal ListCaption As String, ByVal ListItems As XmlNode) Label1.Text = ListCaption Dim Items As XmlNodeList = ListItems.Selec tNodes("Items/Item") For Each Item As XmlNode In Items Dim li As New ListItem li.Value = Item.Attributes ("id").Value li.Text = Item.Attributes ("value").Va lue DropDownList1.I tems.Add(li) Next End Sub
I would like to call this from my webform by writing:
Dim UControl As UserControl = CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"), UserControl)
UControl.Popula teDropDownList( "Recipient' s Name:", RecipientNamesN ode)
This doesn't work. The PopulateDropDow nList doesn't appear in the intellisense list. What appears in the list are the properties and methids of a UserControl (as anyone would expect).
How can I do this? I know that it's possible; I just can't think of a way how.
Does anyone know of a good online reference for coding UserControls?
TIA, -- Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Thanks,
I love it when I miss the obvious.
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"RCS" wrote: It looks like you need to Dim your UControl as the specific object you are loading.. in other words:
Dim UControl As AugmentedDropDo wnList = CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"),A ugmentedDropDow nList)
Because intellisense looks to see what kind of object you have loaded - and it thinks you just loaded an object of type UserControl - and you need to be clear that it is an object of type AugmentedDropDo wnList.
HTH
"Joe" <jo******@donot spam.yahoo.com> wrote in message news:01******** *************** ***********@mic rosoft.com... Hello All,
I have a UserControl wwhich consists of one Label and one DropDownList control. I have written a Public methofd to allow me to set the Label's Text property and populate the dropdownlist with listitems. Here's the code:
Public Sub PopulateDropDow nList(ByVal ListCaption As String, ByVal ListItems As XmlNode) Label1.Text = ListCaption Dim Items As XmlNodeList = ListItems.Selec tNodes("Items/Item") For Each Item As XmlNode In Items Dim li As New ListItem li.Value = Item.Attributes ("id").Value li.Text = Item.Attributes ("value").Va lue DropDownList1.I tems.Add(li) Next End Sub
I would like to call this from my webform by writing:
Dim UControl As UserControl = CType(LoadContr ol("UserControl s/AugmentedDropDo wnList.ascx"), UserControl)
UControl.Popula teDropDownList( "Recipient' s Name:", RecipientNamesN ode)
This doesn't work. The PopulateDropDow nList doesn't appear in the intellisense list. What appears in the list are the properties and methids of a UserControl (as anyone would expect).
How can I do this? I know that it's possible; I just can't think of a way how.
Does anyone know of a good online reference for coding UserControls?
TIA, -- Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Hargrove |
last post by:
I am building a database to manage test samples in an environmental
laboratory. I am learning Access as I go and don't know much about
the programming aspects. I hope to make the application user-friendly
for the sample login people by populating form controls. Using the
DLookup function, I am able to populate a form control in one record
using table data. I want to be able to populate multiple records of a
subform control (test...
|
by: Lauren Quantrell |
last post by:
I'm using SQL Server backend on an Access 2K front end.
I populate a subform:
Forms!myForm.myChild.Form.RecordSource = "myStoredProcedureName"
On that form is a control where the controlsource is "=
Count()"
that shows the user the number of records.
What I'm doing now is populating the subform, using the
RecordsetClone.RecordCount of the subform to determine if any records
were returned, and if not, opening a message box telling the...
|
by: Janus |
last post by:
Hello.
I need a little advice for populating the treeview control.
I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach?
Maybe something eventbased but how? please help...
Should I avoid populating the treeview control using a thread?
|
by: Chris Barrow |
last post by:
Hi everyone,
Does anyone know if there is a problem populating a
system.web.ui.htmlcontrols.htmlinputtext control when the
control's type is set to "password?" I am attempting to
retreive a member's record from a database and populate
the control with the member's password. Unfortunately, if
the control declared on the .aspx side is as follows:
<input type="password" id="txtPassword" runat="server"/>
|
by: Casey |
last post by:
hello,
I need to populate a drop down list when the user clicks
on the arrow button.
how do i do this.
Should i use a html select control or is it possible
using the asp:dropdownlist
| |
by: msnews.microsoft.com |
last post by:
I'd like to hear your thoughts on best methods for populating drop down list
controls. I have states and countries drop down lists that don't change
often, so naturally I "hard code" them in the aspx page. But the problem is
these tend to really slow the development -- it takes up to 15 seconds for
the page to come up in VS.NET design environment, so I'm thinking about
taking these out and populating the controls dynamically using the...
|
by: John Ninan |
last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application
I have a combobox(aspx Page). Which contains various items. Based on item
selected I am dynamically populating Usercontrols.
Problem:
When I am populating dynamic user control (ascx) page in Page_load event it
works fine for the first list item from combobox. When I change the item in
combobox, usercontrols are build properly but value will be same in second...
|
by: |
last post by:
Trying to learn about manipulating collections of objects, and populating
these objects dynamically from datasources. Could someone post a code sample
that shows the following:
Instantiating a collection object -- say, a dictionary.
Populating that collection object with custom objects, say, Person. What I
really want to see is how to populate the properties of those Person objects
from a datasource: instantiate one Person, fill...
|
by: Patrick McGuire |
last post by:
I have a treeview control on a windows form that I want to populate in the form's load event. The problem is that the datatable I am using to populate it contains >20,000 records, and it takes > 1 min to load the form. How can I populate it partially during load and then complete it when the user needs the complete set (i.e. when the user scrolls down)?
|
by: Paul Hadfield |
last post by:
I'm looking for thoughts on the "correct" design for this problem (DotNet
2.0 - in winforms, but that's not so important). I've got two combo boxes
(combo1 and combo2), both are populating via database calls (using a
separate DB handler class). "combo1" contains a list of countries and is
fairly static, it can be added to but no other external events cause a
change in its population. "combo2" however is populated with a list of
options...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |