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
Solved

ASP.NET Calandar with nested radio buttons

Posted on 2009-06-29
4
355 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

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