Ask a Question related to ASP.NET General, Design and Development.
-
sramruttun #1
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>
<asp:CheckBox id="chkM" runat="server" Width="81px"></asp:CheckBox>
</TD>
<TD colSpan="3">
<asp:Label id="Label9" runat="server">Period</asp:Label>
<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 ?
sramruttun Guest
-
RadioButtonList
Maybe you can help me with the following logic I am trying to accomplish. My RadioButtonList is in datagrid <EditItemTemplate> column If my... -
RadioButtonList In DataGrid
Hi all! I have a page that gets a list of users from a database and puts them into a DataGrid. The DataGrid is editable. In Edit Mode of the... -
Radiobuttonlist and cssclass
I am in the process of updating old asp projects into asp.net. We used to have radiobuttons which had an attached css class as follows: <label... -
RadioButtonList and JavaScript ... Help
Hi .... I have a radiobutton list and a label in a webform. <asp:radiobuttonlist id="one" runat="server" CssClass="text" AutoPostBack="False"... -
radiobuttonlist and javascript??
in your page load function add the following: RadioButtonListName.Attributes.Add("onclick", "return JavascriptFunctionName()"); radiobuttonlist... -
sramruttun #2
Re: radiobuttonlist and javascript
thanks marina
I realise the point. What do u suggest?
"Marina" <zlatkinam@nospam.hotmail.com> wrote in message
news:#AtSIv5TDHA.3144@tk2msftngp13.phx.gbl...the> 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" <sramruttun@yahoo.com> wrote in message
> news:%23pPjrN4TDHA.556@TK2MSFTNGP12.phx.gbl...> false> > hi
> > I have a checkbox and a radiobuttonlist (the radiobuttonlist contains 2
> > items) in my form. The radiobuttonlist has its visible property set to> > at design time. At run time, when the checkbox is checked, then I want>> > 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>
> > <asp:CheckBox id="chkM" runat="server" Width="81px"></asp:CheckBox>
> > </TD>
> > <TD colSpan="3">
> > <asp:Label id="Label9" runat="server">Period</asp:Label>
> > <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 ?
> >
> >
>
sramruttun Guest
-
S. Justin Gengo #3
Re: radiobuttonlist and javascript
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:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"sramruttun" <sramruttun@yahoo.com> wrote in message
news:uMU1D9AUDHA.2520@tk2msftngp13.phx.gbl...that> thanks marina
> I realise the point. What do u suggest?
>
> "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
> news:#AtSIv5TDHA.3144@tk2msftngp13.phx.gbl...> > Setting the visible property of a server side object to False, meansvery> > the HTML for it doesn't even get streamed down to the client. This ismenu> > 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 the2> > in IE.
> >
> > "sramruttun" <sramruttun@yahoo.com> wrote in message
> > news:%23pPjrN4TDHA.556@TK2MSFTNGP12.phx.gbl...> > > hi
> > > I have a checkbox and a radiobuttonlist (the radiobuttonlist containsscript> the> > false> > > items) in my form. The radiobuttonlist has its visible property set to> > > at design time. At run time, when the checkbox is checked, then I want> > > 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>
> > > <asp:CheckBox id="chkM" runat="server" Width="81px"></asp:CheckBox>
> > > </TD>
> > > <TD colSpan="3">
> > > <asp:Label id="Label9" runat="server">Period</asp:Label>
> > > <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>> >> > > section and tells that :
> > > 'document.all(...)' is null or not an object
> > >
> > > Where is problem guys ?
> > >
> > >
> >
>
S. Justin Gengo Guest



Reply With Quote

