Re: CheckBox value on HTML page triggered from Code Behind

Tech-Archive recommends: Fix windows errors by optimizing your registry



The property you are looking for is "checked".

docment.all["chb_vIsDefect"].checked = true;

I am not sure if the click event bubbles to actually turn the checkbox, so
you might want return true from this function, so the click event could
bubble.

bill

"Julius Fenata" <idjoel@xxxxxxx> wrote in message
news:%23gTPg4oOFHA.3380@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Mr. Gaurav, I have follow your instructions and thanks for your help,
the
> checkbox change status when has a first click on it, but.. when I
repeatedly
> clicking on it, it doesn't change value anymore.., here is my code:
>
> // HTML
> function JSGeneratePackageID()
> {
> if (document.getElementById("chb_vIsDefect").selected)
> document.getElementById("chb_vIsDefect").selected = false; //
Can't
> work, how to change checkbox value?
> document.getElementById("lbl_vValue").innerText = "false";
> else
> document.getElementById("chb_vIsDefect").selected = true; //
Can't
> work, how to change checkbox value?
> document.getElementById("lbl_vValue").innerText = "true";
> }
>
> // Code Behind
> chb_vIsDefect.Attributes["onClick"] = "JSGeneratePackageID()";
>
>
> Thx,
> Julius F
>
> ===================================================
>
> "MasterGaurav" <gaurav.vaish@xxxxxxxxx> wrote in message
> news:1112779172.589195.52070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > document.getElementById("Label1").value =
> > (document.getElementById("CheckBox1").selected ? "true" : "false");
> >
> > InnerText is not applicable to "<input ..." elements. It's mostly to
> > spans and text areas, where you have an inner-text.
> >
> >
> > CHeers,
> > Gaurav Vaish
> > http://mastergaurav.org
> > http://mastergaurav.blogspot.com
> > ----------------------------
> >
>
>


.