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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to write this ASP code in Java

Status
Not open for further replies.

Dazb75

Programmer
Aug 14, 2002
10
GB
I have developed a Web-based system using VS.Net (3.5 FW).

The System is used to facilitate an inspection process (on a tablet PC). I have multiple sets of mutually exclusive radiobutton lists and checkboxes.

Eg. For each item being inspected, the inspector either ticks a checkbox for "Not Inspected" or selects a score in the radiobuttonlist.

The code I wrote in ASP does work, but causes a small delay.

Is it possible to write this code in ASP to make in run more efficiently?

*** Reset Radio ***

Dim CBName As String
Dim RBName As String
Dim myCB As CheckBox = DirectCast(sender, CheckBox)
CBName = myCB.ID.ToString
RBName = "rb" + CBName.Substring(2)
Dim MyRadio As New RadioButtonList
MyRadio = CType(UpdatePanel1.FindControl(RBName), RadioButtonList)
If myCB.Checked = True Then
MyRadio.SelectedIndex = -1
End If

*** Reset Check ***

Dim CBName As String
Dim RBName As String
Dim myRB As RadioButtonList = DirectCast(sender, RadioButtonList)
RBName = myRB.ID.ToString
CBName = "cb" + RBName.Substring(2)
Dim myCheck As New CheckBox
myCheck = CType(UpdatePanel1.FindControl(CBName), CheckBox)
myCheck.Checked = False

Many thanks.
 
Is it possible to write this ASP code in Java

I'm sure it is, but this being the JavaScript forum, and not the Java forum (which is similar in general syntax, but overall a different programming language to Jasvascript" I'm not sure that we can help you.

On the other hand if you wish to check the radio boxes before submitting the form using Javascript then the translation is very similar:

Code:
var checkBoxkObj = document.getElementById('checkboxID');

var RadioButtonList = document.getElementsByName('RadioBtnsName');

  if(checkBoxObj.checked){
   for(var i=0; i<=RadioButtonList.length -1; i++){
     RadioButtonList[i].checked=false;
   }
 }

For the reverse action, assuming you are calling the function on each of the radioButtons onclick event:

Code:
var checkBoxkObj = document.getElementById('checkboxID');
checkBoxObj.checked=false;

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Actually that is NOT ASP, It looks to be vB.NET one of the languages supported by the ASP.NET Framework.

So I would suggest you need to be in forum855

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top