473,383 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

problem using asp.net ajax

i am using ajaxcontrolkit in my project , only use its calender

but problem is that after selected a date from calender when i press submit button after reload he show the same default date which is current day date not my selected date and also in my server side code when i pick date from textbox it also give me the default current date not the selected date

please any body know about this problem, tell me thanks
Aug 19 '08 #1
2 1032
Curtis Rutland
3,256 Expert 2GB
Are you setting the initial date in your Page_Load method? If so, make sure that you check to see if the page is postback before you do:
Expand|Select|Wrap|Line Numbers
  1. //c#
  2. if(!Page.IsPostBack)
  3.   //code here
  4.  
Expand|Select|Wrap|Line Numbers
  1. 'VB.NET
  2. If Not Page.IsPostBack Then
  3.   'code here
  4. End If
  5.  
Aug 19 '08 #2
page load event code is here
Expand|Select|Wrap|Line Numbers
  1. if (!IsPostBack)
  2.         {            
  3.             CalendarExtender1.SelectedDate = DateTime.Now.Date;
  4.             DateTime date = DateTime.Now.Date;
  5.             tb_select_date.Text = date.Date.ToShortDateString();
  6.             GenerateEmployeeList(date);
  7.         } 
and button click code is this
Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.     {
  3.         DateTime date = Convert.ToDateTime(tb_select_date.Text);
  4.         GenerateEmployeeList(date);
  5.     }
html page
Expand|Select|Wrap|Line Numbers
  1. <table width="100%" cellspacing="0" cellpadding="0">        
  2.          <form id="form1" runat="server">                   
  3.          <tr align="center">        
  4.          <asp:ScriptManager ID="ScriptManager1" runat="server">
  5.                   </asp:ScriptManager>
  6.           <td align="center" style="height: 59px">
  7.                 <b>&nbsp;<asp:Label ID="lb_select_date" runat="server" Text="Select Date"></asp:Label> </b>
  8.                             &nbsp;&nbsp;&nbsp;      
  9.               <asp:TextBox ID="tb_select_date" runat="server" ReadOnly="True"></asp:TextBox>
  10.               <img src="images/calendar.png" id="cld" alt="Click Here For Calendar"/>
  11.                &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;             
  12.               <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="tb_select_date" PopupButtonID="cld">
  13.               </cc1:CalendarExtender>         
  14.           <asp:Button ID="btn_show_record"  runat="server" Text="Show Record" OnClick="Button1_Click" /></td>
  15.           </tr>               
  16.                 </form>                  
  17.           </table>
  18.  
this html page code is enclose in a contentplaceholder master page
Aug 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Karl | last post by:
Hi all. I've recently rebuilt my Vista Ultimate workstation with Visual Studio Team Developer edition. Ive also put on the SQL Server 2005 tools and it's fully patched. I was building a web...
1
by: shivendravikramsingh | last post by:
hello friends, actually i have a problem in using conditional statement in ajax function i m tring to describe my problem properly,what i want when i select a value form a combo its vlue is passed...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
3
by: willl69 | last post by:
Hi All, Ive been having a problem of late with one of my sites that uses PHP5 / Ajax. The problem is that periodically the ajax functions lock up and it gets stuck in the loading phase of the...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
3
rizwan6feb
by: rizwan6feb | last post by:
Hi experts! Recently i was working on "Form Validation Using Ajax". My form validation was creating problem, when a user changes focus too quickly. I had a post related to this, but was unable to...
4
by: sheldonlg | last post by:
I haven't received an answer with my other post, so I am rephrasing it here. In php I have a 2D array which I "print". The headers force it to be a file on the user's system. The user receives...
12
by: sheldonlg | last post by:
Here is my situation. I am coding in an AJAX framework for an intranet application behind a vpn. Therefore, I can't give you a URL for the actual app. I made a sample app for viewing and am...
8
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.