473,503 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio button client events.

How do I create client events for a radio button?
Do I have to switch to HTML controls?
The code below doesn't work.

<body MS_POSITIONING="FlowLayout">
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
RadioButton1.Attributes.add("onchange","javascript :alert('Onchanged
happened'")
end sub
</script>
<form id="Form1" method="post" runat="server">
<asp:RadioButton id="RadioButton1" runat="server" GroupName="sort"
Text="Ascending"></asp:RadioButton>
<asp:RadioButton id="RadioButton2" runat="server" GroupName="sort"
Text="Descending"></asp:RadioButton>
</form>
</body>
Nov 19 '05 #1
3 10002
JavaScript is Case Sensitive.

So try this:
RadioButton1.Attributes.add("onChange","javascript :alert('onChange
happened'")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Arne" <Ar**@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
How do I create client events for a radio button?
Do I have to switch to HTML controls?
The code below doesn't work.

<body MS_POSITIONING="FlowLayout">
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
RadioButton1.Attributes.add("onchange","javascript :alert('Onchanged
happened'")
end sub
</script>
<form id="Form1" method="post" runat="server">
<asp:RadioButton id="RadioButton1" runat="server" GroupName="sort"
Text="Ascending"></asp:RadioButton>
<asp:RadioButton id="RadioButton2" runat="server" GroupName="sort"
Text="Descending"></asp:RadioButton>
</form>
</body>

Nov 19 '05 #2
No it didn't do anything. Here is the output
<span onChange="javascript:alert('Onchanged happened'"><input
id="RadioButton1" type="radio" name="sort" value="RadioButton1" /><label
for="RadioButton1">Ascending</label></span>
<input id="RadioButton2" type="radio" name="sort" value="RadioButton2"
/><label for="RadioButton2">Descending</label>
The onChange event is in the wrong place.

"Steve C. Orr [MVP, MCSD]" wrote:
JavaScript is Case Sensitive.

So try this:
RadioButton1.Attributes.add("onChange","javascript :alert('onChange
happened'")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Arne" <Ar**@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
How do I create client events for a radio button?
Do I have to switch to HTML controls?
The code below doesn't work.

<body MS_POSITIONING="FlowLayout">
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
RadioButton1.Attributes.add("onchange","javascript :alert('Onchanged
happened'")
end sub
</script>
<form id="Form1" method="post" runat="server">
<asp:RadioButton id="RadioButton1" runat="server" GroupName="sort"
Text="Ascending"></asp:RadioButton>
<asp:RadioButton id="RadioButton2" runat="server" GroupName="sort"
Text="Descending"></asp:RadioButton>
</form>
</body>


Nov 19 '05 #3
Yes, I see the problem.
Well it seems the easiest solution would be to use an HTML checkbox instead
of the WebControl.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Arne" <Ar**@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
No it didn't do anything. Here is the output
<span onChange="javascript:alert('Onchanged happened'"><input
id="RadioButton1" type="radio" name="sort" value="RadioButton1" /><label
for="RadioButton1">Ascending</label></span>
<input id="RadioButton2" type="radio" name="sort" value="RadioButton2"
/><label for="RadioButton2">Descending</label>
The onChange event is in the wrong place.

"Steve C. Orr [MVP, MCSD]" wrote:
JavaScript is Case Sensitive.

So try this:
RadioButton1.Attributes.add("onChange","javascript :alert('onChange
happened'")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Arne" <Ar**@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
> How do I create client events for a radio button?
> Do I have to switch to HTML controls?
> The code below doesn't work.
>
> <body MS_POSITIONING="FlowLayout">
> <script runat="server">
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> RadioButton1.Attributes.add("onchange","javascript :alert('Onchanged
> happened'")
> end sub
> </script>
> <form id="Form1" method="post" runat="server">
> <asp:RadioButton id="RadioButton1" runat="server" GroupName="sort"
> Text="Ascending"></asp:RadioButton>
> <asp:RadioButton id="RadioButton2" runat="server" GroupName="sort"
> Text="Descending"></asp:RadioButton>
> </form>
> </body>


Nov 19 '05 #4

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

Similar topics

1
4312
by: Jim Quast | last post by:
I have an ASP page and a CREGReports002.vbs file coded to export data to excel. I do this by building variables in a stored procedure. The ASP page has text boxes, list boxes, and radio buttons. ...
4
3226
by: Jay | last post by:
I have a form used to submit data (no surprises there!). I'd like to be able to populate the same form with previously submitted data. The data lives in a database once submitted and using ASP I...
2
9848
by: jayuya | last post by:
How can i check in java script if a asp.net radio button list server control is selected? I have some custom javascript function in the client side that needs to run but I don't see the way to...
2
1754
by: tshad | last post by:
I have 2 radio buttons: <asp:RadioButton ID="radDetail" GroupName="detailSummary" Text="Detail" checkedChanged="RadDetail_Clicked" runat="server" /> <asp:RadioButton ID="radSummary"...
3
2056
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
24
4465
by: John Gabriel | last post by:
CreateDialogIndirect() fires my Radio button click function without the radio button having being clicked. I am using VC++ 2003.NET. I believe this is yet another Microsoft bug. Have checked dialog...
10
6050
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
2
2877
by: Peted | last post by:
Hi Im using c# express edition 2005 I have an MDI form, where i load multiple child forms from a dll i create, using reflection and late binding The child forms have multiple radio...
2
2089
by: WOWDesign | last post by:
Basically I want a client to tick a radio button, which will then return the value of 1 to the database field PROMO. It's so that they can promote a course on the home page when ticked, out of all...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.