Sep 03, 2013, 8:49 AM
[CLOSED] How to write a datetime composite control which combine DateField and TimeField control
I need a datetime composite control. I want to combine DateField control and TimeField control.
In ASP.NET , I know how to write the code as follow's code.
But I want to use ext.net's layout, I need the CustomDateTime control inside ext:panel's items remark.
How can I write the datetime composite control in Ext.net ? It can use as follows:
In ASP.NET , I know how to write the code as follow's code.
public class CustomDateTime : System.Web.UI.WebControls.CompositeControl
{
DateField ctrdate = new DateField();
TimeField ctrtime = new TimeField();
}
protected override void CreateChildControls()
{
Controls.Clear();
Controls.Add(ctrdate);
Controls.Add(ctrtime);
ChildControlsCreated = true;
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding,"0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
ctrdate.RenderControl(writer);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Td);
ctrtime.RenderControl(writer);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
}
But the CustomDateTime control only can be inside html table remak. It can not be inside ext:panel's items remark.But I want to use ext.net's layout, I need the CustomDateTime control inside ext:panel's items remark.
How can I write the datetime composite control in Ext.net ? It can use as follows:
<ext:Panel ID="PanelResult" runat="server" >
<Items>
<MyControl:CustomDateTime ID="CustomDateTime1" runat="server" ></MyControl:CustomDateTime>
</Items>
</ext:Panel>
Last edited by Daniil; Sep 04, 2013 at 12:01 PM.
Reason: [CLOSED]