Solved

ASP.NET Calandar with nested radio buttons

Posted on 2009-06-29
4
346 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
Comment Utility
I assume that you have set the AutoPostBack property to True on the radio button controls.
0
 
LVL 2

Author Comment

by:JasonChandler
Comment Utility
@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
Comment Utility
@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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 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

11 Experts available now in Live!

Get 1:1 Help Now