green field

DatePicker

The mojoPortal DatePicker control is basically a .NET wrapper around the DynarchJSCalendar.

You can look at example usage in a number of places in mojoPortal including BlogEdit.aspx, but here are soem instructions for using it.

To use this control you need to put the mojoPortal.Web.Controls.dll into the bin folder of your application and set a reference to it. Then in your web.config file, in the system.web pages section add a control declaration like this:
<pages>
    <controls>
        <add tagPrefix="mp" namespace="mojoPortal.Web.Controls" assembly="mojoPortal.Web.Controls" />
    </controls>
</pages>

Now you can use the mojoPortal Web Controls on any .aspx or .ascx file in your project without having to add a declaration at the top.

You also need to put the DatePicker folder and its included javascript files somewhere in your web app. In the mojoPortal Web project I put it beneath the ClientScript folder. In addition, you need to put the .css files from the css folder in the download somewhere in your web app.

You can add a DatePicker to an .aspx page or a .ascx user control like this:

<mp:DatePicker id="dpBeginDate" runat="server"
    Columns="25"
    Required="True"
    ClockHours="24" 
    MaxLength="50"
    StyleDirectory="~/Data/style"
    ScriptDirectory="~/ClientScript/DatePicker" ShowTime="True">
    </mp:DatePicker>

You need to tell the control where you put the needed javascript and css files as shown. If the data captured by the control is required, set Required="True" and a RequiredFieldValidator will be used to enforce the required field.

In code behind .cs file you can set the value like this:

dpBeginDate.Text = DateTime.Now.ToString();

or retrieve its value like this:

blog.StartDate = DateTime.Parse(dpBeginDate.Text);

 


Event Calendar Pro a better event calendar for mojoportal
 
Vote for mojoPortal in the 2008 CMS Awards