Javascript for checkboxes which are in repeater

  • Thread starter Thread starter Atul Rane
  • Start date Start date
A

Atul Rane

I want to find whether user selected any checkbox or not. these CheckBoxes
are in Repeater. I am doing code in c#.net.
 
I want to find whether user selected any checkbox or not. these CheckBoxes
are in Repeater. I am doing code in c#.net.


where do you want to know it?
in the client or in the server?
in the server you need to find the control ( using FindControl() ) and
check the Checked property.
In the client you can do something similar too.
 
Ignacio Machin ( .NET/ C# MVP ) said:
where do you want to know it?
in the client or in the server?
in the server you need to find the control ( using FindControl() ) and
check the Checked property.
In the client you can do something similar too.
client side
 
:





- Show quoted text -

If you want to do it client side you have two options:
1- hook the onchange event of the checkbox, you can do it from the
code behind.
2- Create a script that runs in the client and check the status of the
control, it would need to know the name of the controls.

you can name the controls using a prefix for example and then look for
them.
This is an example:
var trs = document.getElementsByTagName("TR"); //returns all
the TR elements
var foundRows= 0;
for( i=0; i<trs.length; i++)
{
if ( (trs.name!= null) &&
(trs.name.indexOf(this._RowNameIndicator)!= -1) )
{
//found it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top