Solved

ASP.NET Calandar with nested radio buttons

Posted on 2009-06-29
4
352 Views
Last Modified: 2012-05-07
I need to replicate this in asp.net (See Link)
I am able to get radio buttons in to the day I need them in, but I cant get them to post back or do anything. Can anybody help me with this please.
 Thanks
http://www.kuoni.co.uk/holiday/africa_and_indian_ocean/maldives/velassaru_maldives/search_index.html?DPDMYD=12/07/2009&NRNTSD=7&MPLAND=RB&DPTAGD=LON&ROOMTD=067
0
Comment
Question by:JasonChandler
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:vbgb
ID: 24736042
I assume that you have set the AutoPostBack property to True on the radio button controls.
0
 
LVL 2

Author Comment

by:JasonChandler
ID: 24736577
@vbgb:
Hi,
Yes I Have done that, but to no avail.
The code I am using is like this. (Assume I want to add radio buttons to every 5th of any month)

Thanks


        If e.Day.Date.Day = 5 Then
            Dim R As New RadioButton
            With R
                .Text = "Radion Button"
                .GroupName = "RadioButtons"
                .EnableViewState = True
                .AutoPostBack = True
            End With
            e.Cell.Controls.Add(R)
        End If

Open in new window

0
 
LVL 2

Author Comment

by:JasonChandler
ID: 24736587
@vbgb:
Sorry forgot to say, I am using the above code on the Day Render Event of the Calandar.
0
 
LVL 4

Accepted Solution

by:
vbgb earned 250 total points
ID: 24737052
Hi Jason

I have tried out what you are trying to do and can see what the problem is.

The radio buttons seem to work in that you can select one, but the postback doesn't fire. The other major issue is that as you are dynamically creating the radio button controls in the render event, each time you change month or select a day, the postback will re-render the calendar and clear all the radio buttons - i.e their viewstate is lost because they are recreated on each day rendering.

I would suggest that what you need is some form of button to get the user to click to confirm their choice and then pick up the value in each radio button in the page load event that happens on postback.
If you do this you would need to give the radio buttons an ID so that you can read the value of them using FindControl. This is complex though as the radiobuttons are members of the calendar.cells.controls collection and I cannot find a way to enumerate the cells and then check each one for a radiobutton!!

 Sorry, this doesn't seem very helpful, but I think you may need a different approach - you should be able to use Javascript to check the values in the visible radiobuttons and then save them (in a hidden field) and do a postback to finish any server side processing.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
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…

770 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