Solved

help getting CheckedChanged working on radio buttons .net VB

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generate Numbers in JQuery file 11 66
edit .asp files 5 31
C# MVC Insert Multiple Row into DB 2 30
How to filter by key press ? 6 20
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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