Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Opening up a Calendar when clicking on a Text Box

Posted on 2008-11-11
20
Medium Priority
?
839 Views
Last Modified: 2013-11-08
Please see attached graphic first.

I would like my users to be able to:
1.  Click on the 'Date' text box and then a small calendar to open up where they will have to select the day, month and year.
2. Select the 'Display" text box and change the desired number of lines they wish to view in the gridview below. (it will default to 10)
3. Then click a Submit button and see the results.
4. The Result gridview will show 10 lines or the desired 'display" value of lines entered.

The table to display has 4 fields,   Date (datetime), day(varchar), PeopleHelped (INT), Value(smallmoney)
, and to make it easy on me, I have already created a record for each day of the Year 2008 and 2009, so all they have to do is to click on the 'edit' icon in the Gridview to start editing.  Users will do this process daily.

Question:  How do I make a Calendar appear when they click on the date textbox? and how do I pass this variable to the gridview.  Also, how do I pass the value of the variable 'display' to my gridview?

I hope this is not confusing.  Thanks,
0
Comment
Question by:Aaron Thorn
  • 11
  • 7
  • 2
20 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 150 total points
ID: 22932022
why don't you use a DateTimePicker control?
0
 

Author Comment

by:Aaron Thorn
ID: 22932163
Does Visual Studio 2008 have the Date/Time picker control?  I did not see that in my Toolbox.  Also, I have read about using AJAX or ATLAS  ????, which I am trying to avoid unless I have too, I have it on my PC, but I don't know if I need to install AJAX in my ASP.net server?

If the Date/Time Picker control is not part of Visual Studio 2008, where can I find it?

Thanks,

Attached is the graphic I forgot to attach !!!!!


Request1.jpg
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 150 total points
ID: 22933238
You are doing web application. That's good to know! Have a look at http://www.eworldui.net/CustomControls/CalendarPopup.aspx
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 

Author Comment

by:Aaron Thorn
ID: 22935092
Thanks Emoreau,  I just downloaded the eworldus from the link you sent me, I have run the install, but I don't see it in my Toolbar  column in VS2008 ... I am searching on their site to see how to make it work ... If you know the fastest way, please let me know. thanks.
0
 

Author Comment

by:Aaron Thorn
ID: 22935274
Okay, finally I got it installed.  I just need to play with it and see if I can pass the date selected from the calendar to my gridview.  Thanks.
0
 
LVL 6

Accepted Solution

by:
M3mph15 earned 1050 total points
ID: 22937011
The easiet thing to use is the Calender Extender from the ASP.Net Ajax Control Toolkit.
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/Setup.aspx
0
 

Author Comment

by:Aaron Thorn
ID: 22943891
Hello guys,

I having problems making AJAX work.

My system:  Visual Studio 2008 Professional SP1, ASP.NET 3.5 (reinstalled okay, not needed but I did it anyway), Downloaded the latest AJAX ControlToolKit from the ASP.NET website, I installed properly, I see the Toolbox for AJAX Toolkit but I cannot drag it into my form, it does not let me, I have created a test ASP.NET Website , I did not see the template AJAX enabled site, I read that in SP1 and 3.5 it will not show in the list of templates.

If you have another alternative for this Calendar popup please let me know.

Also I have tried the one from www.eworldui.com  as recommended by 'emoreau' but seems to work, but when I cannot bind the calendar text box with my GridView, I don't see the calendar ID so I can pass the selected date to my gridview results.

Thanks.
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22946115
Hi,
When i installed the AJAX ControlToolkit i didn't get that AJAX enabled website template either. All you need to do is add a script manager onto the page, thats all the template changes i think.
As for dragging it onto the page, the easiest way i find to use it is in design view click on the textbox and then click on the little arrow to the right that should expand a small menu with an option "Add Extender". This will show all the available extenders for that control.
0
 

Author Comment

by:Aaron Thorn
ID: 22946836
M3mph15,
It must be something obvious that I am missing.  See attached graphic: You see that I have all the Ajax controls in my Toolbox on the Left, they are not grayed out at all, as soon as I drag it out of the Toolbox, it shows me the symbol that it cannot be done ( this is the NO symbol, the circle with the slash across), I even have the Script Manager there, also when I place a Standard Text Box, I don't see the little arrow anywhere that can give me the "Add Extender" option, I tried looking for it.  

What drives me crazy is the fact that when I run the Calendar Demo that came with the AjaxControToolkit.zip it runs perfectly fine, please see the second attached image.

Thanks,
ajaxdemo1.jpg
ajaxdemo2.jpg
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22946937
Hi,
The controls from the AjaxControlToolkit con not be dragged onto the webpage in desing view. They can however be dragged into the source view. And then in the source view you can set the TargetControlId to set which control it will extend.
Also i Have attached an image of the arrow i was talking about.
Either method will work. Going through the menu that the arrow shows will set the TargetControlId etc. automatically.

HTH
-M3mph15

textbox.bmp
0
 

Author Comment

by:Aaron Thorn
ID: 22949230
Thanks M3,

I made lots of progress with your info. Thanks!  I just need to know how to pass the selected calendar date to my GridView.  I want the user to select the 'date' from the calendar and then click Submit, and refresh the GridView to start with that selected calendar date.  Please see attached image of my progress.
ajaxcal2.jpg
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22956808
Ok, When you say start from that date do you mean show records from that date and onwards or just the records with that date.

What is the datasource of your gridview (in other words where is it getting the data from Database etc.)
If it is from a Database. What i would do is On the click of the subimt button create an sql statement with a WHERE clause including the selected date.
e.g "SELECT [columnnames] from [tablename] WHERE DATE = " & txtDate.Text
txtDate is the name of your textbox. Also you may need to use the TO_DATE function depending on what database it is.

That sql statement can be set to the SelectCommand of the Database and then you can rebind the GridView to show the changes.
HTH
-M3mph15
 
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22956815
Soz. correction That sql statement can be Set to the SelectCommand of the DataSource*
0
 

Author Comment

by:Aaron Thorn
ID: 22961683
Hello M3,
After trying your advise I get this (see attached images).  My control text box is called txtDate , and when I pass it to the Grid, it gives me a DateTime format error, how can i convert from txtDate.txt to a Date format?   also, please what is the string I may use if I want to set txtDate to Today's date?

I used the string -->   & txtDate.Text    as you provided.  Thanks.

Thanks M3.
datetimeerr1..jpg
datetimeerr2..jpg
0
 

Author Comment

by:Aaron Thorn
ID: 22961688
Thanks for the follow up!
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22972733
Ok, So the grid is looking for something in the format as DateTime. Depending on what format your date is in you can adjust the code accordingly. I'm going to assume your date is something like 21/12/2008. (Day/Month/Year) Try the following:

Dim s As String = txtDate.Text
Dim t() As String = s.Split("/")  'This will split the string at each '/'
Dim intDay As Integer = System.Convert.ToInt32(t(0))
Dim intMonth As Integer = System.Convert.ToInt32(t(1))
Dim intYear As Integer = System.Convert.ToInt32(t(2))
Dim dt As New DateTime(intYear, intMonth, intDay)  'Then pass this to the grid.

As for the default value of Date i believe you can use SYSDATE to get todays date. Or if you are doing it in the code behind Date.Today works aswell.

HTH
-M3mph15
0
 

Author Comment

by:Aaron Thorn
ID: 22977487
Hi M3,
1.  I tried sysdate with no avail, also I tried getdate(),  Date.Today in the value field, and still cannot make it work.  Please see attached image.
2.  All  I need is to click on the Calendar Extender, select the Date I need my GridView to show me and clck submit. Since the txtDate  control box is a text and is passed to the Gridview date colum it tells me the is an improper format DateTime.
3.  There must be a simple way of passing the text value in txtDate (from my calendar selection) to the 'date' field in my GridView below.
4. I did not know where to insert the code you sent me last time, does that go in the codebehind for the GridView? or the submit button? or the txtDate?

Thanks.
grid2err.jpg
0
 
LVL 6

Assisted Solution

by:M3mph15
M3mph15 earned 1050 total points
ID: 22981751
Hi,
I am not too familar with the way you are using so unfortunately i'm out of ideas sorry.
0
 

Author Comment

by:Aaron Thorn
ID: 22984152
Anyone one there that knows Visual Studio 2008.  This problem is the most basic.  The question is, how do you pass a Calendar selected value from an AJAX Calendar extended to a text box, to a 'date' colum value on a Gridview? without writing any code or very little code with specific instructions.  The Client here does not know any coding.

0
 

Author Closing Comment

by:Aaron Thorn
ID: 31515579
Nobody has reponded in a week.  I am closing it without a solution.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

581 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