Accueil > > > GRIDVIEW DATE PICKER JAVASCRIPT
GRIDVIEW DATE PICKER JAVASCRIPT
Information sur la source
Description
utilisation d un date picker en javascript dans une gridview en edition insertion des donnes grace au footer
Source
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.ComponentModel;
-
- namespace DatePiker
- {
- [ValidationPropertyAttribute("CalendarDateString")]
- public partial class Calendar_Date : System.Web.UI.UserControl
- {
- // date format used by the calendar control
- private const string DateFormat = "dd/MM/yyyy";
-
- protected void Page_Load(object sender, EventArgs e)
- {
- string scriptStr = "javascript:return popUpCalendar(this, '" + ResolveUrl("cal") + "/', document.getElementById('" + getClientID() + @"'), '" + DateFormat + "')";
- imgCalendar.Attributes.Add("onclick", scriptStr);
- }
-
- // Get the id of the control rendered on client side
- // Very essential for Javascript Calendar scripts to locate the textbox
- public string getClientID()
- {
- return txt_Date.ClientID;
- }
-
- [Category("Appearance")]
- [Description("CSS class name applied to the text box.")]
- [Browsable(true)]
- public string TextCssClass
- {
- get { return txt_Date.CssClass; }
- set { txt_Date.CssClass = value; }
- }
-
- /// <summary>
- /// Gets or sets the content of the textbox which represents a date.
- /// </summary>
- [Bindable(true, BindingDirection.TwoWay)]
- [Browsable(true)]
- public string CalendarDateString
- {
- get
- {
- return txt_Date.Text;
- }
- set
- {
- txt_Date.Text = value;
- DateTime date;
- if (DateTime.TryParseExact(value, DateFormat, null, System.Globalization.DateTimeStyles.None, out date))
- {
- if (date.Date == DateTime.MaxValue.Date)
- {
- txt_Date.Text = "";
- }
- }
- }
- }
-
- /// <summary>
- /// Gets or sets a DateTime representation of the currently selected date.
- /// </summary>
- [Bindable(true, BindingDirection.TwoWay)]
- [Browsable(true)]
- public DateTime CalendarDate
- {
- get
- {
- DateTime date;
- if (DateTime.TryParseExact(txt_Date.Text, DateFormat, null, System.Globalization.DateTimeStyles.None, out date))
- {
- return date;
- }
- return DateTime.MaxValue;
- }
- set
- {
- txt_Date.Text = value.ToString(DateFormat);
- }
- }
- }
-
- }
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
namespace DatePiker
{
[ValidationPropertyAttribute("CalendarDateString")]
public partial class Calendar_Date : System.Web.UI.UserControl
{
// date format used by the calendar control
private const string DateFormat = "dd/MM/yyyy";
protected void Page_Load(object sender, EventArgs e)
{
string scriptStr = "javascript:return popUpCalendar(this, '" + ResolveUrl("cal") + "/', document.getElementById('" + getClientID() + @"'), '" + DateFormat + "')";
imgCalendar.Attributes.Add("onclick", scriptStr);
}
// Get the id of the control rendered on client side
// Very essential for Javascript Calendar scripts to locate the textbox
public string getClientID()
{
return txt_Date.ClientID;
}
[Category("Appearance")]
[Description("CSS class name applied to the text box.")]
[Browsable(true)]
public string TextCssClass
{
get { return txt_Date.CssClass; }
set { txt_Date.CssClass = value; }
}
/// <summary>
/// Gets or sets the content of the textbox which represents a date.
/// </summary>
[Bindable(true, BindingDirection.TwoWay)]
[Browsable(true)]
public string CalendarDateString
{
get
{
return txt_Date.Text;
}
set
{
txt_Date.Text = value;
DateTime date;
if (DateTime.TryParseExact(value, DateFormat, null, System.Globalization.DateTimeStyles.None, out date))
{
if (date.Date == DateTime.MaxValue.Date)
{
txt_Date.Text = "";
}
}
}
}
/// <summary>
/// Gets or sets a DateTime representation of the currently selected date.
/// </summary>
[Bindable(true, BindingDirection.TwoWay)]
[Browsable(true)]
public DateTime CalendarDate
{
get
{
DateTime date;
if (DateTime.TryParseExact(txt_Date.Text, DateFormat, null, System.Globalization.DateTimeStyles.None, out date))
{
return date;
}
return DateTime.MaxValue;
}
set
{
txt_Date.Text = value.ToString(DateFormat);
}
}
}
}
Historique
- 31 décembre 2008 10:20:11 :
- mise a jour du path du fichier xml
pour simplifier
mise en solution du site
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
HELP!Recuperer une variable de type DATE!! [ par nomed ]
Bonjour à tous,J'ai un grave problème, et j'espère que quelqu'un ici à la solution.J'essai de recuperer une chaîne de caractère et de l'implementer da
[asp.net 2] GridView et CultureInfo [ par bigflo93 ]
Salut à tous :)Je rencontre un pb assez embêtant en asp.net 2.0 et avec le nouveau controle GridView...En fait, il s'agit d'un problème
Binding de propriété de UserControl contenu dans un GridView [ par fred2734 ]
Bonjour,J'ai crée un user control que j'utilise dans une colonne template d'un gridview ... Les données du gridview sont chargées via un dataset.Je do
GridView & UserControl [ par mephhh ]
Bonjour,Je souhaite utiliser un GridView, avec dans la dernière colonne un UserControl, étant lui-même un GridView (http://www.codeguru.com/columns/vb
gridView + insert ? [ par paloxicide ]
je suis sous .net 2je viens de créer un gridViewTout marche bien sauf pour le ajouter. Je comprends pas comment ca fonctionneQuand je clique dess
Passer une donnée d'une ligne de GridView à un UserControl [ par obitskater ]
Bonjour à tous,Voilà, dans ma page principal j'ai une GridView avec pour chaque ligne un HoverMenu Ajax.Net, dans lequel il y a des liens permettant l
accessdatasource insert qui ne fonctionne pas [ par vandedan ]
Bonjour,j'ai deux petits soucis avec un accessdatasource.insert.Sur une page aspx, j'ai un dropdownlist (populate par le contenu d'un champ "inspecteu
Prb: usercontrol et gridview [ par neofenix ]
Bonjour tout le monde,voila j'ai un gridview qui m'affiche une table de ma base de données qui est rempli par un formulaire contenu dans un gridview j
Gridview - probleme d'update er de requirefieldvalidator [ par nerone21 ]
Bonjour les codeurs...J'ai un petit gros problème et je compte sur vous...Je suis ultra noob en ASP.net, je code avec VS2008 et en vb.net.Je travaille
format du date gridview [ par midoutnn ]
Bonjour, j'ai une application web faite avec asp.net lié a une base de donné SQL crée avec (visual web developper 2010). mon probléleme c'es quand j'a
|
Derniers Blogs
[WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
RE : FORMULAIRERE : FORMULAIRE par ap24dp
Cliquez pour lire la suite par ap24dp RE : FORMULAIRERE : FORMULAIRE par Megafan
Cliquez pour lire la suite par Megafan FORMULAIREFORMULAIRE par ap24dp
Cliquez pour lire la suite par ap24dp
Logiciels
Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning
|