Solved

help getting CheckedChanged working on radio buttons .net VB

Posted on 2010-09-17
3
403 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
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Why, and when, to use Windows Workflow 1 20
c# regex: extract & replace text between braces 6 30
Hide Tab Page 3 19
XML & .net 5 20
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now