Welcome to Dream.In.Code
Become an Expert!

Join 150,390 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,070 people online right now. Registration is fast and FREE... Join Now!




VB 2005 and ASP.NET: Problems with the Calendar Control

 
Reply to this topicStart new topic

VB 2005 and ASP.NET: Problems with the Calendar Control

trosoft
9 Mar, 2008 - 07:00 AM
Post #1

New D.I.C Head
*

Joined: 24 Feb, 2008
Posts: 5



Thanked: 1 times
My Contributions


Hi folks,

I am experiencing two problems with the calendar control. I have two such controls: cldStartDate and cldEndDate.

I want the users to be able to select a date range. However, each time that I click a date, the screen jumps up and
down wildly. It is very distracting. I imagine that it is due to a postback refresh? What can I do to avoid this
troublesome distraction?

In addition, when I select a date in cldStartDate, and then select one in cldEndDate, the selection in cldStartDate
automatically clears (and visa versa). How can I prevent this from happening.

Thank you in advance,

trosoft
User is offlineProfile CardPM
+Quote Post

Jayman
RE: VB 2005 And ASP.NET: Problems With The Calendar Control
9 Mar, 2008 - 09:37 AM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,327



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
You can avoid the PostBack issue by using an AJAX update panel. You will need to download and install Ajax extensions which can be found here.

You can find a little tutorial here to help get you started.

What type of controls are cldStartDate an cldEndDate?

If you post your code we can be of more help.
User is offlineProfile CardPM
+Quote Post

vamsi kare
RE: VB 2005 And ASP.NET: Problems With The Calendar Control
12 Mar, 2008 - 10:05 PM
Post #3

New D.I.C Head
*

Joined: 11 Mar, 2008
Posts: 4

Hi,

During this postback, the current state of the page and its controls are sent to the server for processing. This process causes the page to refresh and is costly because of the amount of data sent back and forth to the server.

Solution: using Ajax

In AJAX word, A stands for Asynchronous. Asynchronous means not occurring at the same time.

AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.

Here is the sample code:

CODE


<form id="form1" runat="server">
    <div>
     <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
        </asp:ScriptManager>
    </div>
    <asp:DropDownList ID="DropDownList1" runat="server"
        AutoPostBack="True">
        <asp:ListItem Value="1">Jan</asp:ListItem>
        <asp:ListItem Value="2">Feb</asp:ListItem>
        <asp:ListItem Value="3">Mar</asp:ListItem>
        <asp:ListItem Value="4">Apr</asp:ListItem>
        <asp:ListItem Value="5">May</asp:ListItem>
        <asp:ListItem Value="6">Jun</asp:ListItem>
        <asp:ListItem Value="7">Jul</asp:ListItem>
        <asp:ListItem Value="8">Aug</asp:ListItem>
        <asp:ListItem Value="9">Sep</asp:ListItem>
        <asp:ListItem Value="10">Oct</asp:ListItem>
        <asp:ListItem Value="11">Nov</asp:ListItem>
        <asp:ListItem Value="12">Dec</asp:ListItem>
    </asp:DropDownList>

    Year

    <asp:DropDownList ID="DropDownList2" runat="server"
        AutoPostBack="True">
        <asp:ListItem>2005</asp:ListItem>
        <asp:ListItem>2006</asp:ListItem>
        <asp:ListItem>2007</asp:ListItem>
    </asp:DropDownList><br />

    <br />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Calendar ID="calendar1" runat="server"  BackColor="AliceBlue">
            </asp:Calendar>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>





Ajax

more about server-centric and client-centric programming in Ajax

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 05:35PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month