Solved

help getting CheckedChanged working on radio buttons .net VB

Posted on 2010-09-17
3
409 Views
Last Modified: 2012-05-10
I'm trying to get a sub to run when a radio button is selected. My code looks like this, but it's not working. What am I doing wrong? Thanks.

Page Code:
<asp:RadioButton id="register" GroupName="tiles" runat="server"/>

Code behind:
    Protected Sub register_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles register.CheckedChanged
        Message.Text = "working"
    End Sub
Imports System.Data.SqlClient
Imports System.Configuration

Partial Class _admin_tiles_edit
    Inherits System.Web.UI.Page


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fileName As String
        Dim fileName2 As String
        If register.Checked Then
            fileName = "register_off.png"
            fileName2 = "register_on.png"
        ElseIf mailing_list.Checked Then
            fileName = "mailing_list_off.png"
            fileName2 = "mailing_list_on.png"
        ElseIf center_bar.Checked Then
            fileName = "center_bar_off.png"
            fileName2 = "center_bar_on.png"
        ElseIf photos.Checked Then
            fileName = "photos_off.png"
            fileName2 = "photos_on.png"
        ElseIf rules.Checked Then
            fileName = "rules_off.png"
            fileName2 = "rules_on.png"
        ElseIf store.Checked Then
            fileName = "store_off.png"
            fileName2 = "store_on.png"
        End If
        If FileUpload1.HasFile Then
            ' = FileUpload1.FileName
            FileUpload1.SaveAs(MapPath("images/" & fileName))
            Message.Text = "Changes complete."
        Else
            Message.Text = "Error, please try again."
        End If

        If FileUpload2.HasFile Then
            ' = FileUpload2.FileName
            FileUpload2.SaveAs(MapPath("images/" & fileName2))
            Message.Text = "Changes complete."
        Else
            Message.Text = "Error, please try again."
        End If
    End Sub

    
    Protected Sub register_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles register.CheckedChanged
        Message.Text = "working"
    End Sub
End Class

Open in new window

0
Comment
Question by:elliottbenzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

by:
informaniac earned 500 total points
ID: 33707039
Set AutoPostBack="true" for the radiobutton
0
 
LVL 3

Expert Comment

by:ghayasurrehman
ID: 33707062
<asp:RadioButton id="register" AutoPostback="true" checked_change="register_CheckedChanged" GroupName="tiles" runat="server"/>
0
 
LVL 4

Author Closing Comment

by:elliottbenzle
ID: 33707122
thanks
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question