Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding values to a checkbox list control

Status
Not open for further replies.

lsmyth1717

Programmer
Mar 25, 2005
44
GB
Hi Everyone

I'm going to use my first <asp:CheckBoxList> control to create a list of selections which users can choose from and run a search against. In other words they are going to act as the parameters of query.

I want to store the values in the web-config and then bind to the values to the checkbox list.

Has anyone done anything like this and if so can someone show me the best way to bind this values. Should I do it using a BindData function called from the page load or is there another way i should be doing this. Thanks for any help anyone can give me.


In case anyone is wondering i can't pull the values back from the database as they are the actual names of fields as opposed to the values within a field.

e.g
Table Fields and values
u_publications u_judgements u_policy
0 0 1
1 0 1
0 1 0

I want my field names to be the values which are added to the checkbox list which is why i was thinking of storing them in the web config.

 
Dim l As ListItem = New ListItem("configText", "configValue")
Me.chkListClients.Items.Add(l)

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Which event should i add this code too?
Is there a way of storing multiple values in the web config. I.e can i store an array of values
 
I don't understand why you need to store these values. Use the code that checkai provided to add the values to your checkbox list. You can do this in your page_load event in an if isnotpostback block.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top