I found a good javascript to do this in the code project.


-- In [email protected], "Peter Brunone"
<[EMAIL PROTECTED]> wrote:
> 
>       Why don't you give us a sample of your checkboxlist HTML (from
> the browser)?  That way those of us who never play with checkboxlists
> can see how the name/id attributes are set up.
> 
>       Also, you might do well to ask this on AspNetClient.
> 
> Peter
> 
> -----Original Message-----
> From: [email protected] On Behalf Of scaevola637
> 
> Yingjin_us,
>   this works great for listboxes.  Do you have anything for removing
> checkboxlists? 
> 
> --- In [email protected], "yingjin_us"
> <[EMAIL PROTECTED]> wrote:
> > Here is the JavaScript function that I tested working with your
> problem:
> >     function ResetDropDowns_EstateInfo()
> >     {       
> >         lb = document.getElementById("lbAmenitiesSelected").options;
> >         for(var i=lb.length-1;i>=0; i--)
> >                             lb.remove(i);                   
> >     }
> > 
> > Ying
> > --- In [email protected], P P <[EMAIL PROTECTED]> 
> > wrote:
> > > Hi All
> > > 
> > > I'm facing this strange problem in Javascript +
> > > ASP.NET, can somebody please tell me why the RESET is
> > > not working using Javascript.
> > > 
> > > Here is the function (2 versions) which I call from javascript; I 
> > > wanted the code to delete all the items from the list-box 
> > > "lbAmenitiesSelected", but it does nothing, neither does it report 
> > > any error.
> > > 
> > > Code-1
> > > ======
> > > function ResetDropDowns_EstateInfo()
> > > {
> > > document.frmEstateInfo.lbAmenitiesSelected.Items.Clear();
> > >  
> > > }
> > > 
> > > 
> > > Code-2
> > > ======
> > > function ResetDropDowns_EstateInfo()
> > > {
> > >   for (h =
> document.frmEstateInfo.lbAmenitiesSelected.Items.Count-1;
> > > h >= 0; h--)
> > >   {
> > >   
> > > //document.frmEstateInfo.lbAmenitiesSelected.Items.RemoveAt(h);
> > >   
> > > //document.frmEstateInfo.lbAmenitiesSelected.Items.removeItemAt(h);
> > >   
> > >
> >
> //document.frmEstateInfo.lbAmenitiesSelected.Items.removeItemFromSelecti
> on
> > > (h);
> > >   
> > > document.frmEstateInfo.lbAmenitiesSelected.deleteItem(h);
> > >   }
> > > }
> > > 
> > > 
> > > Thanks in advance
> > > PP




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to