Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Pppulate checkboxlist from a set of avlues

I need a checkboxlist to be populated from a DataTable /ArrayList.

The data is not pulled from the database.It is a set of hardcoded values. Where is the best place to put the hardcoded values.One place might be web.config .But is there any other better solution
Thanks!!
0
Bkuniyil
Asked:
Bkuniyil
2 Solutions
 
divinewind80Commented:
You could set the values in the OnLoad event of the CheckBoxList, like so:

Public Sub cbl1_load(ByVal sender As Object, ByVal e As System.EventArgs)
        CheckBoxList1.Items.Add("TEST")

    End Sub

Does that help?
0
 
SQL_SERVER_DBACommented:
With this XML file:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<item value="1" text="Value 1" />
<item value="2" text="Value 2" />
<item value="3" text="Value 3" />
</root>

And this code:
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
DataSourceID="XmlDataSource1"
DataTextField="text" DataValueField="value">
</asp:CheckBoxList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Data/XMLFile.xml"></asp:XmlDataSource>


I got this from....http://www.velocityreviews.com/forums/t108318-populate-checkboxlist-from-xmldatasource-aspnet-20.html
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now