Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / July 2003

Tip: Looking for answers? Try searching our database.

radiobuttonlist in javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sramruttun - 21 Jul 2003 13:27 GMT
hi
I have a checkbox and a radiobuttonlist (the radiobuttonlist contains 2
items) in my form. The radiobuttonlist has its visible property set to false
at design time. At run time, when the checkbox is checked, then I want the
radiobuttonlist to appear. I want to use javascript.

On Form_Load I've done:
chkM.Attributes.Add("onclick", "ShowPeriod('" & RDLPeriod.ClientId &
"');return false;")

The HTML Source:

<TR>
    <TD>
<asp:Label id="Label8" runat="server">Monthly</asp:Label>&nbsp;
<asp:CheckBox id="chkM" runat="server" Width="81px"></asp:CheckBox>
    </TD>
    <TD colSpan="3">
       <asp:Label id="Label9" runat="server">Period</asp:Label>&nbsp;
       <asp:RadioButtonList id="RDLPeriod" runat="server"
RepeatDirection="Horizontal" Visible="False">
   <asp:ListItem Value="All">All</asp:ListItem>
  <asp:ListItem Value="Current Year">Current Year</asp:ListItem>
       </asp:RadioButtonList>
   </TD>
</TR>

In the script section I have:
function ShowPeriod(w)
{
  document.all(w).visible=true;
  //document.getElementById("RDLPeriod").style.visibility=true;
}

Upon execution, when I check the checkbox, the code breaks in the script
section and tells that :
   'document.all(...)' is null or not an object

Where is problem guys ?
bruce barker - 21 Jul 2003 17:36 GMT
your approach will not work. asp.net does not render controls whose visible
property has been set to false. you will have to hide the control with
client script.

-- bruce (sqlwork.com)

> hi
> I have a checkbox and a radiobuttonlist (the radiobuttonlist contains 2
[quoted text clipped - 35 lines]
>
> Where is problem guys ?
sramruttun - 22 Jul 2003 06:11 GMT
thanks bruce
I just learnt about that.
Probably I can disable it instead of setting visible to false, what do u
think?

> your approach will not work. asp.net does not render controls whose visible
> property has been set to false. you will have to hide the control with
[quoted text clipped - 42 lines]
> >
> > Where is problem guys ?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.