Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 14th, 2008, 08:35 AM
Authorized User
 
Join Date: Aug 2007
Location: Colne, Lancashire, United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Radiobuttons

Hi All,

I have an app that I wish to have 2 radiobuttons (or a radiobuttonlist)

Currently I can't seem to get any c# code to do anything, even though I have my oncheckchanged command in the aspx in the appropriate tag. Is there anything else i'm missing?

  #2 (permalink)  
Old April 14th, 2008, 12:46 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
quote:Is there anything else i'm missing?
Not entirely sure about you, but what we are missing is sample code of the problematic page.... ;)

Post the relevant parts of the so we can take a look at it....

Cheers,


Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old April 15th, 2008, 04:08 AM
Authorized User
 
Join Date: Aug 2007
Location: Colne, Lancashire, United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Haha fair do's!

My aspx

Code:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
            <asp:ListItem>Internal</asp:ListItem>
            <asp:ListItem>Commercial/General/NHS</asp:ListItem>
        </asp:RadioButtonList>


c#
Code:
 protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Radiobutton");
    }
any thoughts?
  #4 (permalink)  
Old April 15th, 2008, 12:03 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Certainly. You are mixing Web Forms and Win Forms. Take a look at this:

MessageBox.Show("Radiobutton");

Where do you think this fires? At the client? Nope; this fires at the server and does NOT translate into something like an alert() call. In ASP.NET applications, you can't use MessageBox.Show. I think it's just swallowed by the framework.

Try writing to a Label instead. E.g. add a <label /> control to the page and then try:

Label1.Text = "Radiobutton";

Maybe you are new to ASP.NET? If so, you may want to check out my new book Beginning ASP.NET 3.5, located here: http://www.wrox.com/WileyCDA/WroxTit...47018759X.html

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #5 (permalink)  
Old April 16th, 2008, 04:50 AM
Authorized User
 
Join Date: Aug 2007
Location: Colne, Lancashire, United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, MessageBox is a c# method I have written that uses Javascript, so it can popup buttons on the clients. The radiobuttons reference si just to pop up a textbox saying radiobutton to see ti go into the event, but this isn't the case.

  #6 (permalink)  
Old April 16th, 2008, 05:07 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

But did you try out the label I suggested? Maybe your MessageBox code isn't working?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #7 (permalink)  
Old April 18th, 2008, 10:29 AM
Authorized User
 
Join Date: Aug 2007
Location: Colne, Lancashire, United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Apologies, I must have been having a bad day. I have got it working now. I wasn't posting back the changes so couldn't see my changes...

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to pull values from dynamic radiobuttons kwilliams ASP.NET 2.0 Professional 0 November 14th, 2008 11:54 AM
DataBinding with Radiobuttons vgsgowrisankar C# 2005 0 May 8th, 2008 05:15 AM
Assigning radiobuttons hydra14 C# 7 June 5th, 2004 12:25 AM



All times are GMT -4. The time now is 06:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.