|
-
Nov 26th, 2008, 06:00 AM
#1
Thread Starter
Fanatic Member
Request.Form CheckBoxList
On my webpage their is a userwebcontrol that contains a checkboxlist.
im tryin to retrieve the checked values of this list using
Request.Form("ct100$TreatmentsCheckList")
but this returns nothing...
is their anyway to get the selected items
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Nov 26th, 2008, 03:19 PM
#2
Re: Request.Form CheckBoxList
Create a property in your UserControl that will return a collection of checked items. Loop through them, do whatever you need to do after.
-
Nov 26th, 2008, 05:20 PM
#3
Thread Starter
Fanatic Member
Re: Request.Form CheckBoxList
hi serge, could you give me an example what you are talking about.
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Nov 27th, 2008, 11:55 AM
#4
Re: Request.Form CheckBoxList
It means that you need to expose your checkbox list items.
So, you'd have something like
MyControlName.SelectedTreatments
You would access it from the parent page. Your control in turn would have a bit of logic in the get part for this public property. (SelectedTreatments is going to be your public property inside the user control)
That logic would need to loop through the actual control and find out what's checked and return those values.
Code:
public List<string> SelectedTreatments
{
get
{
//Loop through the checkboxlist and find out which ones are selected, add them to your list of strings or whatever type you want.
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|