I use aspnet 4 and c#.
My user need inserting DATE and TIME in a field.
The data to pass to DataBase has this format
2011-02-23 10:30:29.27 and DataType: datetime2
I can see in visual studio just a Calendar WebControl but it is able to handle just the date and not the time.
I found an interested WebControl at:
http://demos.telerik.com/aspnet-ajax/calendar/examples/overview/defaultcs.aspx
Specially functuion for Time Picker.
My question do you know any Free/Open source control?
If not any other solution WebControl or not?
Thanks
I don't know if you are willing to use jQuery UI. If you are, Trent Richardson has extended the jQuery UI DatePicker to include a TimePicker.
This might work for you: http://trentrichardson.com/examples/timepicker/
There are a lot of sample on the page so it sould be pretty easy to use and you can wire up to your asp.net backend a number of ways including a static webmethod exposed via a scriptmanager.
Hope this helps.
Related
I have ASP.NET application in which I have Date and Time displayed but I want seconds number to roll on every second without refreshing the page
I am displaying the Date and Time using the following line
<p>#DateTime.Now</p>
Can I get the best way to do it.
You'll need to make a little javascript to do that. you can't do it server side.
you can use setInterval(1000) and set the value of the element to the time every second.
I don't think you can do this in your razor view but there are a ton of ways to do this in javascript. A few examples:
PURE JAVASCRIPT: http://www.elated.com/res/File/articles/development/javascript/creating-a-javascript-clock/clock.html
ANGULAR: http://docs.angularjs.org/guide/directive (search for "Creating a Directive that Manipulates the DOM")
There are lots of other examples out there - search google and you should find them. Good luck!
If you want a server time do a jquery ajax call and retrieve the correct server time from an ajaxworker page.
I'm working in C# / ASP.NET 3.5 and want to enable users to enter their date-of-birth. I've tried the asp:Calendar web control for this, and also considered using the jQuery-UI datepicker, and reviewed suggestions from this question.
All those options don't seem to have the "mode" I want though. I do not want an actual calendar to pop up, but just a Day/Month/Year dropdown. My requirements:
Just three dropdowns, for day/month/year
Ability to set a min and max year
Client side solution for helping pick a valid date (so don't allow 30 + February)
Nice to have: culture based position switch for day/month and month/day
Can anyone suggest such a control? Or should I just move on and build it myself?
Jeroen, there is no built in control.
The simple way to do this is add 3 drop down lists and add all months / years (Those are the simple ones). Days change, so either you can statically add 31 and do some checking, or use a database that holds a bunch of dates and use that as the datasource.
I used a jQuery add in that handled this for me, I was able to update a hidden field that could be read from ASP.Net code behind, sorry I can't remember the exact plug-in but if you search on the jQuery site you should find it (I had a quick look but couldn't track it down, jQuery site search is pants).
jQuery's datepicker might be what you want:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/
I have some questions regarding calendars
Is there any good calendar generates for either asp.net mvc or jquery. I would like to find something that can make calendars and have features like this.
Generates all the months (but of course only features the current month that is being displayed)
If the name of the calendar event is too long it cuts it off and if you click on it a popup comes showing you the full description
Ability to add a new task to the calendar. So when you click on it pops up a dialog box and you can fill out information.
So basically what Google calendar can do. You can add a task then it pops up with like where, time notifications area.
So is there any sort of solution like this for .net MVC or jquery? If not then I am willing to use other javascript frameworks if needed but rather not.
I checked out http://arshaw.com/fullcalendar/ and it really does not have everything I need.
I like this one http://www.redredred.com.au/projects/jquery-week-calendar/
Since it almost does what I want but the major draw back this is that it only does weeks not a full month.
Is there some sort of library that I can use to easily import google calendar data in, outlook calendar data in and basically any major calendar program.
I know that icalendar is like the standard format so is there a C# library that will like parse this stuff?
I going to need to store the calendar data in a database. How would the database table look like?
I think that for the client side, you are asking for a little too much, to be honest. Your best bet is find the one that does the most that you want out-of-the-box but has enough customization to allow for you to fill in the functionality you are looking for. Either that, or write the code from scratch. To be honest, you are rendering a table with some jQuery on the front end for client-side events. It's tedious, but shouldn't be overly difficult.
As for a .NET library to handle calendar formats, I recommend DDay's iCal. It has some issues and requires some understanding to get running, but it works (I use it myself for a site that I project iCalendar entries from).
As for the calendar in the database, that's really up to you. The minimal amount of information you need is a date field, obviously. I'd recommend something with an offset (SQL Server 2008 has the datetimeoffset) since you might want to take into account time zones. Beyond that, any information you want to store is up to you.
In response to chobo2's comment about how to get the data to appear in the appropriate column, when you render the table, you are going to have a 7 x 5 table (seven days, five rows). I would suggest tagging each of them with the date.
Then, as you render your table, when you render the cell, you look to see if you have any events for your date, if you do, then render the cell appropriately.
Why don't you start slightly less ambitiously? Google has a large team working on their calendar and for you to hope to replicate that without taking years will just end up with an unfinished project.
1
You said you didn't like FullCalendar but it does support 95% of the features you need from the calendar, minus actually clicking on days to add events.
FullCalendar is great for displaying
events, but it isn't a complete
solution for event content-management.
Beyond dragging an event to a
different time/day, you cannot change
an event's name or other associated
data. It is up to you to add this
functionality through FullCalendar's
event hooks
You get a dayClick event which you could use to add an event. I wouldn't bother though going this route though, and simply have a separate panel on the page with a text box for the name, a small icon which makes a Jquery UI calendar appear. It sounds low-tech but the pain of getting the click event working in all browsers would be a big task.
This textbox displays the full event name when you click on day which gets around your long text cropping issue. Alternatively this shows you a nice static html iCal-like solution which you may have looked at already.
Generating a month calendar for the year could be done statically using HTML instead of using jQuery.
2
If you stick to the iCalendar format for Outlook and Google, which both support it, then it's very easy to write a parser for that format as it's such a simple text format. This question has more details on making one, you could use an existing library for it.
3
A simple table of equivalent SQL types like below will be enough:
Events
Id
Name
Location
DateTime Start
DateTime End
bool IsRecurring
Recurring events will be the hardest part because of the calculations you have to perform to work out the next event. You don't store each occurrence in the database. Using the epoch for the calculations might help out, it's a technique Exchange uses.
how do i make an autocomplete textbox in asp?
but i need to get the autocomplete data by querying the database.
I dont really know how to explain this, sory if theres not enough detail.
i cant use ajax, because i think i will have compability issues with my old app.
so im thinking of doing this using java script. or is there a way to do this by using .net?
im using C# for codebehind. thanks
It's going to be a lot of effort without using some third party autocomplete I think - not sure what you mean by 'I can't use ajax', but how about using the ASP.NET AJAX autocomplete control, setting the ServiceMethod property to a static Page Method in your code behind? That keeps it contained within your page at least.
The Page Method can go off to your database, and return a String[] of results.
If you decide to use it, you'll need to set the EnablePageMethods property to true in the <asp:ScriptManager> control.
AJAX is JavaScript. It's JavaScript using the XMLHttpRequest object to make the asynchronous request. Here's an article about it and ASP.NET.
If you want to know more about AJAX, (Asynchronous JavaScript and XML), I'd check out Wikipedia first. If you want books on it, there are a ton. I recommend Programming ASP.NET AJAX by Christian Wenz (O'Reilly And Associates).
if you dont want to uses ajax library, try jquery
there are many plugin autocomplete or suggest textbox for jquery
try this one
http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/
The ASP.NET AJAX framework works for ASP.NET 2.0 & above. As such it will not work in Visual Studio 2003 environment.
Anthem.NET is a free, cross-browser AJAX toolkit/framework for the ASP.NET development environment that works with both ASP.NET 1.1 and 2.0 -
http://sourceforge.net/projects/anthem-dot-net
For your autocomplete requirement, you can consider using the jQuery Autocomplete Plugin
It requires very less programming. Check the demo & code sample here - http://docs.jquery.com/Plugins/Autocomplete
It's autocomplete() method takes a URL or array to populate your autocompletion list. You can pass the URL of the page that fetches the results from the database directly.
I'm new to .NET and my first project is to create a event calendar to be populated from a events table in mSQL. I know there is a calendar object in the standard components but wondered if i'm better off populating a table view manually as i didn't know if there were lots of limitations to the standard object/component.
Thanks for your help
This can be done quite easily with the built-in calendar control that .NET provides. You're basically dealing with the DayRender event.
An excellent example can be found here: http://www.c-sharpcorner.com/UploadFile/munnamax/DatabaseDriven08212007012112AM/DatabaseDriven.aspx
You can use the standard calendar control. It will give you the ability to perform code in each cell (day) creation, so you can query your DB, find your dates, and during that paticular date's load, you can write any necessary content inside the cell.