Jurnal de programator
99,9% Microsoft
Send mail to the author(s)
Home | Mini tools List| Blog carti| ASP.NET MVC ebook| tutorial 3.5| Subscribe by Email | twitter| linkedin | youtube | interviu
Monday, November 02, 2009
<< Post precedent: JetBrains dot trace 3.1

Jquery si date picker

Stiu ca ma chinuisem pina sa gasesc un control de calendar pentru ASP.NET (RJS.POPCALENDAR) -si apoi deodata am data de ASP.NET MVC – si deodata nu functiona.

Asa ca solutia a fost sa caut cu jquery – si bineinteles exista www.jqueryui.com .

Ce aveti de facut daca aveti un textbox , de ex

<input type="text" id="FromDate" name="FromDate" value="<% =ViewData.Model.data.ToString("yyyy-MM-dd") %>" />

- si vreti un mic buton linga el care sa afiseze calendarul ? Nimic mai simplu . Downloadati de la www.jqueryui.com/download jquery-ui, adaugati la proiect in folderul scripts,puneti imaginea de buton (sa ii zicem calndar.jpg) si urmatorul cod :

$(document).ready(function() {
    //seteaza date picker
    var hid = ($("#FromDate").attr("type") == "hidden");
    if (!hid)//daca nu e input type = hidden

{
       

$("#FromDate").datepicker({
            showOn: 'button', buttonImage: '/content/images/calendar.jpg’, buttonImageOnly: true
               , changeMonth: true, changeYear: true
               , dateFormat: 'yy-mm-dd'//, numberOfMonths: 2
        });
    }

ASP.NET | Asp.NET MVC | calendar | jquery
Monday, November 02, 2009 3:43:00 AM (GMT Standard Time, UTC+00:00)  #    Comments [5]  |  Trackback

Pe scurt despre oamenii d... >>
Monday, November 02, 2009 12:16:39 PM (GMT Standard Time, UTC+00:00)
Interesant - pana acuma am folosit fara probleme calendarul de la Dynarch(Mishoo - Mihai Bazon): http://www.dynarch.com/projects/calendar/old/ - gratis si practic un standard de-facto in domeniu.. (folosit de foarte multe site-uri..)
Tudor
Monday, November 02, 2009 12:33:11 PM (GMT Standard Time, UTC+00:00)
Multumesc Tudor!
Ignat Andrei
Monday, November 02, 2009 4:06:25 PM (GMT Standard Time, UTC+00:00)
La fel ca Tudor, si eu folosesc aceeasi componenta de calendar :) Oricum, in ultima vreme a inceput sa ma pasioneze JS. Se fac niste lucruri de te doare capu'...
Lucian
Monday, November 02, 2009 4:29:11 PM (GMT Standard Time, UTC+00:00)
Lucian , Tudor,
Ce js-uri mai folositi ? m-ar bucura sa le aflu ;-)
Ignat Andrei
Tuesday, November 03, 2009 10:10:17 AM (GMT Standard Time, UTC+00:00)
Din pacate in ultimii 3 ani a trebuit sa lucrez preponderent cu WinForms, asa ca ceea ce foloseam pe vremuri in aplicati web s-ar putea sa fie cam obsolete acuma (sa fi aparut componente JS mai noi/bune etc..).
Am folosit oricum Yahoo UI library (http://developer.yahoo.com/yui/), Overlib (http://www.bosrup.com/web/overlib/), Milonic JS menu (http://www.milonic.com/ - pe vremea cand inca era gratis)
Tudor
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview

Theme design by Jelle Druyts

Pick a theme: