Hi there,
I have a typesafe collection in my application called Countries, which
is derived from the ReadOnlyCollect ionBase. As you might guess, the
item-value is of type Country. Each Country has (for now) and ID and a
Name property.
Now I'd like to use a CheckBoxList to display the contents of my
Countries collection and let the user select some:
// chklCountries is the CheckBoxList
Countries colCountries = new Countries();
chklCountries.D ataSource = colCountries;
chklCountries.D ataTextField = "Name"; // Country.Name?
chklCountries.D ataValueField = "ID"; // Country.ID?
chklCountries.D ataBind();
There are no countries loaded at runtime eventhough the collection works
correctly. The HTML output is a funny:
<table id="chklCountri es" border="0">
</table>
That's it. What am I missing?
--
/Matthias 3 1362
It's hard to tell from that snippet, but:
(1) It looks like you created an array but didn't add any items to the
array. maybe you left that out or it's hidden in the collection's
implemenation?
(2) does your Country class contain public properties or just public
member variables?
"Matthias S." <postamt@_remov e_emvoid_remove _.de> wrote in message
news:OD******** *****@TK2MSFTNG P15.phx.gbl... Hi there,
I have a typesafe collection in my application called Countries, which is derived from the ReadOnlyCollect ionBase. As you might guess, the item-value is of type Country. Each Country has (for now) and ID and a Name property.
Now I'd like to use a CheckBoxList to display the contents of my Countries collection and let the user select some:
Agreed..but wanted to specifically point out the "funny" output...a
checkboxlist gets rendered inside a table....unless you change the
RepeatLayout to "flow" in which case it gets rendered inside <span>...it's
an empty table because, as Jv pointed out, there are no records in the
collection.
Also, the reason you need properties vs fields is that it uses the
reflection GetProperty method...just an fyi..
karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"JV" <jo**********@g oisc.com> wrote in message
news:eU******** *****@tk2msftng p13.phx.gbl... It's hard to tell from that snippet, but: (1) It looks like you created an array but didn't add any items to the array. maybe you left that out or it's hidden in the collection's implemenation? (2) does your Country class contain public properties or just public member variables?
"Matthias S." <postamt@_remov e_emvoid_remove _.de> wrote in message news:OD******** *****@TK2MSFTNG P15.phx.gbl... Hi there,
I have a typesafe collection in my application called Countries, which
is derived from the ReadOnlyCollect ionBase. As you might guess, the item-value is of type Country. Each Country has (for now) and ID and a Name property.
Now I'd like to use a CheckBoxList to display the contents of my
Countries collection and let the user select some:
I'm honestly sorry about it guys: It was me playing blind-fish. Yes, the
collection was actually empty ;(
/Matthias
Karl Seguin wrote: Agreed..but wanted to specifically point out the "funny" output...a checkboxlist gets rendered inside a table....unless you change the RepeatLayout to "flow" in which case it gets rendered inside <span>...it's an empty table because, as Jv pointed out, there are no records in the collection.
Also, the reason you need properties vs fields is that it uses the reflection GetProperty method...just an fyi..
karl This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rufus |
last post by:
Hi,
I have a custom collection class that inherits from HashTable. When I add a
new CustomObject to my CustomCollection I would like to ensure that it will
only accept objects of type CustomObject. How would I do this? Thanks in
advance.
Public Class CustomCollection
Inherits Hashtable
' default constructor
|
by: Bryce Budd |
last post by:
Hello All,
I've been a taker of information from newsgroups for a long time and thought
I'd finally make a contribution back to the community whose supported me
when I've needed it. After all before commercialization took over that was
the beauty of the Internet!
I've create a checkboxlist validator control...something MS should have done
originally in my opinion, but nonetheless here it is. It's a C# control,
sort of IE specific. ...
|
by: Robin Day |
last post by:
I run some code on the changed event of checkbox lists. Its quite simple,
nothing more than showing / hiding some other parts of the page.
Using Autopostback and Server side code works fine, but is far too slow,
especially if the users are on modems.
I need to quite simply, add some java code to the onclick event of the input
tags of a checkboxlist.
However... Attributes.Add adds the onclick attribute and code to the
outlying table that...
|
by: Dune |
last post by:
Hi,
Is there anyway to get the datavaluefield from a databound checkboxlist
using javascript?
If not, is there any way to associate a custom attribute with the databound
checkboxlist items so that the custom attribute can be accessed using
javascript?
Cheers
|
by: Jamey Shuemaker |
last post by:
I'm in the process of expanding my knowledge and use of Class Modules.
I've perused MSDN and this and other sites, and I'm pretty comfortable
with my understanding of Class Modules with the exception of custom
Collection Classes.
Background: I'm developing an A2K .mdb to be deployed as an .mde at my
current job-site. It has several custom controls which utilize custom
classes to wrap built-in controls, and add additional functionality....
| |
by: webmaster |
last post by:
Hi all,
I'm tearing my hair out with this one.
I have successfully implemented by own RadioButtonList in order to
provide additional functionality and a DIV rather than TABLE-based
layout in one of my ASP.NET 1.1 web forms. This involves a fairly
simple inheritance of the System.Web.UI.WebControls.RadioButtonList
class, with some new properties added and the Render sub overridden.
When I come to render each radio item, I do the...
|
by: jeremy |
last post by:
Had a tough time figuring this one out and couldn't find a good
solution, so I thought I would post this and hopefully it will help
someone out.
When using DataBind to dynamically bind a list to the CheckBoxList
control in ASP .NET, I had a hard time figuring out how to dynamically
select the items that needed to be selected. Specifically, I was
displaying checkboxes for Roles, and I wanted to check the boxes of
the roles that were...
|
by: sean worlock |
last post by:
Hello all,
I have googled like crazy for this with no sucess!
I have a dataset containing a table with the following fields
Table===Widths
---------------------------------------------
WidthID---int (primary key)
Width------decimal
|
by: Andy B |
last post by:
I have the following checkBoxList in a web page. I set the DataSource in the
code behind (shown below the control) to a Dictionary<string, string>
collection. When I run the page, I get some formatting in the control that I
want to change. For this example, I get the key/value pair of the dictionary
inside of (). For example:
Page output:
|
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: 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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |