Solved

ASP.net (CheckBoxList) determine which Item was Checked

Posted on 2014-02-06
9
427 Views
Last Modified: 2014-02-12
Hello Experts!

Let me start by saying I don't want to loop through all the checkboxlist items.

What I'm trying to do is if a certian item is checked within the checkboxlist items box I want to disable the rest of the items in the list.

You see if have a list of roles...if the administrator selects the "Reporting" Role I want to disable ALL the other roles as this is the ONLY role they are allowed to have.  Vise Versa if they uncheck the "Reporting" role I want to enable the rest of the roles again to be allowed to be checked off.

I have the checkboxlist inside a UpdatePanel so it will only Post Back this area of the page, but I want to know if that item is checked rather than looping through the whole list to see if that was checked off then have to loop through again to disable the rest of the roles.

Any ideas??

Thanks,
Mark
0
Comment
Question by:smithmrk
  • 5
  • 4
9 Comments
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 39839417
I once saw a nice example.. try this..

var selected = CBLGold.Items.Cast<ListItem>().Where(x => x.Selected);

and populate other items
0
 

Author Comment

by:smithmrk
ID: 39839427
Is this JavaScript or Code Behind?
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 39839477
Code behind Linq
0
 

Author Comment

by:smithmrk
ID: 39839489
OH...then this won't work, I'm using Visual Studio 2005 (.net 2.0) so Linq will NOT work.

Any other ideas??

Thanks,
Mark
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 19

Expert Comment

by:Melih SARICA
ID: 39839504
Jquery  posibility ?
0
 

Author Comment

by:smithmrk
ID: 39839527
There is no way to get the item that was just checked in Code Behind?

If I click a box it automatically posts back...there must be a way to get the item I just checked off.

Mark
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 500 total points
ID: 39839572
Nope its not possible.. with checkboxlist. Its explained in MSDN

http://msdn.microsoft.com/en-US/library/y860k7cx(v=vs.80).aspx

but an idea u can try ..

Putting indidual checkboxes with repeater and setting  CheckedChanged event to an event can help u i guess..
<repeater>
 <header>
   <panel>
  </header>
 <item>
   <checkbox  CheckedChanged="samefunctionforallcheckboxes>
  </item>
<footer>
  </panel>
</footer>
</repeater>

then u can reach all checkboxes from panel.controls
0
 

Author Comment

by:smithmrk
ID: 39839588
OK, I'll get back to you then...stay tune.
I'll try it out and get back to you.

Mark
0
 

Author Closing Comment

by:smithmrk
ID: 39854626
Well I'll give you the points for helping me out...but I decided to do it a totally different way rather than screw around with the CheckBoxList.

Thanks for the help though!

Mark
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending E-mail ASP.Net 3 58
what technologies offer Authentication over Web Services? 4 106
Tool Box 2 35
Name space syntax error 12 44
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now