Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET Calandar with nested radio buttons

Posted on 2009-06-29
4
Medium Priority
?
372 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
[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
  • 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 1000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

721 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