Last post Nov 19, 2010 06:34 PM by sjnaughton
Member
18 Points
119 Posts
Nov 19, 2010 09:09 AM|yani|LINK
Net.3.5 ScaffoldAllTables = true
Trying to add the ajax CalendarExtender
On the partial (from sql-view)
[MetadataType(typeof(View_Order_AllMetaData))] public partial class View_Order_All { } public class View_Order_AllMetaData { [UIHint("Calendar")] public object OrderDate { get; set; } }
---------------------
on the Calendar_Edit.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Calendar_Edit.ascx.cs" Inherits="DynamicData_FieldTemplates_Calendar_Edit" %> <asp:TextBox ID="TextBox1" runat="server" CssClass="droplist" Text='<%# FieldValueEditString %>' Columns="20"></asp:TextBox> <cc1:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" TargetControlID="TextBox1"></cc1:CalendarExtender> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" CssClass="droplist" ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" /> <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" CssClass="droplist" ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" /> <asp:DynamicValidator runat="server" ID="DynamicValidator1" CssClass="droplist" ControlToValidate="TextBox1" Display="Dynamic" />
----------------------------
on the Calendar_Edit.ascx.cs
using System; using System.Collections.Specialized; using System.Web.UI; public partial class DynamicData_FieldTemplates_Calendar_Edit : System.Web.DynamicData.FieldTemplateUserControl { protected void Page_Load(object sender, EventArgs e) { TextBox1.ToolTip = Column.Description; SetUpValidator(RequiredFieldValidator1); SetUpValidator(RegularExpressionValidator1); SetUpValidator(DynamicValidator1); } protected override void ExtractValues(IOrderedDictionary dictionary) { dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text); } public override Control DataControl { get { return TextBox1; } } }
thanks
All-Star
17916 Points
5681 Posts
MVP
Nov 19, 2010 10:17 AM|sjnaughton|LINK
Hi Yani, try this in your code behind
private String DATE_FORMAT = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; protected void Page_Load(object sender, EventArgs e) { TextBox1_CalendarExtender.Format = DATE_FORMAT; TextBox1.ToolTip = Column.Description; TextBox1.Columns = DateTime.Now.ToString(DATE_FORMAT).Length; SetUpValidator(RequiredFieldValidator1); SetUpValidator(RegularExpressionValidator1); SetUpValidator(DynamicValidator1); }
Works for me and also sorts out an y culture issues [:)]
Dynamic Data
Nov 19, 2010 12:22 PM|yani|LINK
Thank you 4 last post
no change
Nov 19, 2010 06:34 PM|sjnaughton|LINK
Hi Yani, what version of DD are you running? and if you e-mail me (via contact button) I will send you a working template.
Dynamic Data Date FieldTemplate
Member
18 Points
119 Posts
Trying to add the ajax CalendarExtender
Nov 19, 2010 09:09 AM|yani|LINK
Net.3.5 ScaffoldAllTables = true
Trying to add the ajax CalendarExtender
On the partial (from sql-view)
---------------------
on the Calendar_Edit.ascx
----------------------------
on the Calendar_Edit.ascx.cs
thanks
All-Star
17916 Points
5681 Posts
MVP
Re: Trying to add the ajax CalendarExtender
Nov 19, 2010 10:17 AM|sjnaughton|LINK
Hi Yani, try this in your code behind
Works for me and also sorts out an y culture issues [:)]
Dynamic Data
Always seeking an elegant solution.
Member
18 Points
119 Posts
Re: Trying to add the ajax CalendarExtender
Nov 19, 2010 12:22 PM|yani|LINK
Thank you 4 last post
no change
All-Star
17916 Points
5681 Posts
MVP
Re: Trying to add the ajax CalendarExtender
Nov 19, 2010 06:34 PM|sjnaughton|LINK
Hi Yani, what version of DD are you running? and if you e-mail me (via contact button) I will send you a working template.
Dynamic Data Date FieldTemplate
Always seeking an elegant solution.