Solved

help getting CheckedChanged working on radio buttons .net VB

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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
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…

734 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