codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Checking/UnChecking While Enabling/Disabling Checkbox  GailG at 16:45 on Monday, May 17, 2004
 

I am updating a page which has a table with four checkboxes that receives data from a db. The results are sent to a database, but only two of the four checkbox values are stored into two fields in the db.

???How do I apply Javascript to accomplish this task?????? And where would the JavaScript be placed??????????????????
Thank You.

Critical
The user can not select more than two of the four checkboxes at any given time; the remaing 2 checkboxes must always be

disabled.

Currently
When the page loads the appropriate 2 of the 4 checkboxes are checked and the remaining 2 are unchecked and enabled.

Goal:
(1) When the page loads how do I disabled the 2 unchecked checkboxes.
(2) When the user unchecks 1 of the 2 currently checked checkboxes--enable the other 2 checkboxes which were previously
disabled.
(3) Only 2 of the 4 checkboxes are checked at any given time and the remaining 2 must be disabled.

My code snipet------>When the page loads, my aspx.vb is:

If DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode1") = "Q" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode2") = "Q" Then
chkQuality.Checked = True
End If

If DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode1") = "F" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode2") = "F" Then
chkFinancial.Checked = True
End If

If DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode1") = "C" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode2") = "C" Then
chkCustomer.Checked = True
End If

If DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode1") = "E" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("TypeCode2") = "E" Then
chkEmployee.Checked = True
End If

My .aspx looks like:
<htm>
<head><title>Checkbox and More</title></Head>
<body>
<form>
<table>
<asp:checkbox id="chkQuality" runat="server" Text="Quality">
</asp:checkbox>
<asp:checkbox id="chkFinancial" runat="server" Text="Financial">
</asp:checkbox>
<asp:checkbox id="chkCustomer" runat="server" Text="Customer Service"> </asp:checkbox>
<asp:checkbox id="chkEmployee" runat="server" Text="Employee">
</asp:checkbox>
<asp:button id="btnUpdate" runat="server" Font-Names="Arial" Text="Save">
</asp:button>
</table>
</form>
</body>
</html>









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: onload event
•  Active Widgets
•  Re: onmouseover change image and text
•  Line Printer Interface
•  import contacts of msn/yahoo
•  Call windows apps from web apps
•  Re: ASP.NET web controls
•  netscape 6 browser problem
•  Re: Print .doc file from the website using System.Diagnostics.Process


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005