473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

radiobuttonlist and javascript

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.visibil ity=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 ?
Nov 17 '05 #1
2 10560
thanks marina
I realise the point. What do u suggest?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl...
Setting the visible property of a server side object to False, means that
the HTML for it doesn't even get streamed down to the client. This is very
different from setting the "display:none" in the style of the object.

The problem is, the HTML for your radiobuttonlist never made it to the
client. This will be easy to check by chosing View -> Source from the menu
in IE.

"sramruttun" <sr********@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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.visibil ity=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 ?


Nov 17 '05 #2
Sam,

Attach the javascript at the same time you set the list to visible, and
remove it if the list's visiblity is reset to false.

chkM.Attributes.Remove("onclick")

I hope this helps.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"sramruttun" <sr********@yahoo.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
thanks marina
I realise the point. What do u suggest?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl...
Setting the visible property of a server side object to False, means that
the HTML for it doesn't even get streamed down to the client. This is very different from setting the "display:none" in the style of the object.

The problem is, the HTML for your radiobuttonlist never made it to the
client. This will be easy to check by chosing View -> Source from the menu in IE.

"sramruttun" <sr********@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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.visibil ity=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 ?



Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Suresh.P.R | last post by:
Hi, While using the RadioButtonList control, that I populated in the runtime, I am not able to get the selected item in the javascript while referring document.Form.RadioButtonList.value. ...
2
by: Sean | last post by:
Hi .... I have a radiobutton list and a label in a webform. <asp:radiobuttonlist id="one" runat="server" CssClass="text" AutoPostBack="False" RepeatDirection="Horizontal"> <asp:ListItem...
2
by: mg | last post by:
After a selection is made in the following RadioButtonList <asp:RadioButtonList id="RadioButtonList1" runat="server"> <asp:ListItem Value="Y"></asp:ListItem> <asp:ListItem...
5
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 --...
6
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and...
0
by: Ryan Taylor | last post by:
Hello. I am having another issue. I need to execute some JavaScript whenever a radio button is clicked. I am currently using a RadioButtonList control to generate the radio buttons because of...
2
by: Alphonse Giambrone | last post by:
Hi all, I have two radiobuttonlist controls on a page. When a user checks 'No' for rblDeleted, I want to automatically set rblSendCard to 'No' and disable it. The javascript function I wrote to...
2
by: rishi pariahr via .NET 247 | last post by:
how to make validation on items of radiobuttonlist for checked or not in jsp,when these items are populated from database. -------------------------------- From: rishi pariahr ...
1
by: novice_developer | last post by:
Hi All, there is a radiobuttonlist having 2 list items (state & zipcode). when i select state radiobutton the zipcode textbox should be disabled and when i select a zipcode radiobutton the state...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.