.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

validate sharepoint datetime control

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :SharePoint
Hi   i am using sharepoint datetime control. i need to validate  user entering past date. (should not allow).   <asp:CompareValidator ID="Comparevalidator1" runat="server" ErrorMessage="The date must be greater than today"                                     ControlToValidate="dtExpiryDate" Operator="LessThanEqual" Type="date" ValueToCompare='<%# DateTime.Now.ToShortDateString() %>' />   The above code throwing error.   Rgds, Vinay

View Complete Post

More Related Resource Links

validate sharepoint datetime control

Hi   i am using sharepoint datetime control. i need to validate  user entering past date. (should not allow).   <asp:CompareValidator ID="Comparevalidator1" runat="server" ErrorMessage="The date must be greater than today"                                     ControlToValidate="dtExpiryDate" Operator="LessThanEqual" Type="date" ValueToCompare='<%# DateTime.Now.ToShortDateString() %>' />   The above code throwing error.   Rgds, Vinay

How to Fire events on SharePoint DateTime Control in visual web part

Hi All, I am working on visual webpart of SharePoint 2010. I am using a <SharePoint:DateTimeControl> i m trying  to fire OnDateChanged event on it. I am not getting the Appropriate way to create the event. please help me out!!!!   void ToDate_OnDateChanged(object sender, EventArgs e)         {                         if (ToDate != null)             {                 DateTime min = Convert.ToDateTime(FromDate.SelectedDate.ToString());                 DateTime max = Convert.ToDateTime(ToDate.SelectedDate.ToString());                 int noofdays = Convert.ToInt32((max - min).TotalDays);                 txtNoOfDays.Text = noofdays.ToString();             }         }    <SharePoint:DateTimeControl runat="server" Calendar="Gregorian"  

How to validate the Sharepoint's InputFormTextBox control

validating the Sharepoint's rich text box control.

SharePoint DateTime control returning current date when no date is selected

In WSS 3.0, I am using sharePoint DateTime control. I retrieve the date selected by the user using SelectedDate property of the sharePoint DateTime control.

The issue is that even when the user has not selected any date in the sharePoint DateTime control, the SelectedDate property of the sharePoint DateTime control returns current date. I guess it should return DateTime.MinValue or null when the user has not selected any date in the sharePoint DateTime control.

Kindly clarify.


SharePoint DateTime control validation



In the Visual web part, i have added few sharepoint datetime controls.


        <td>             <asp:Label ID="lblBirthDate" runat="server" Text="Birth Date"></asp:Label>
           <SharePoint:DateTimeControl ID="DteDOB"  DateOnly="true" IsRequiredField="true" runat="server"  />
            <asp:CompareValidator id="valDOBDate" runat="server"
          ErrorMessage="Please enter an valid d

Choosing Between a User Control or Web Part for SharePoint

SharePoint will only display Web Parts on a page. However, there are publicly available shims that allow you to write user controls and have them be displayed as a Web Part. From SharePoint's point of view, the shim is a Web Part. From the point of view of the user control, the shim is simply a control in .NET that is including the user control

Take Control: Use SharePoint to Manage Your Windows Services


In this article, we show you how to integrate a Windows Services-based solution with SharePoint. The results enable you to provision, start, stop, and remove service instances through SharePoint 3.0 Central Administration.

Pav Cherny

MSDN Magazine April 2009

Problem in Custom Control Unable to find Control To Validate Property


I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'


My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

SharePoint read/recognize a Digital Signature in Word (XML Content Control Mapping)?

I am using Content Control Mapping to pull certain fields from a Word Document and include it as columns when a document is uploaded into a Document Library. We're using MOSS 2007 and Word 2007. It is required that the user digitally signs the document before uploading.  Is there a way to get the signature to appear as a column in a similar fashion?  I'm new to this mapping business, and Google hasn't been much help. I realize I could use the Collect Signatures workflow, but that seems cumbersome to 1) have the user submit it, 2) have an admin open each document and start the workflow and 3) have the user THEN sign the document.  That's more steps than simply manually opening and verifying digital signatures. I figure I'm missing something obvious here.  Any help or ideas would be appreciated.

Creating Custom ASP.NET Control for use on a SharePoint 2010 OOTB WebPart

I am currently trying to develop a custom asp.net control that can be deployed to SharePoint 2010 and then included on something like a New item form. I have been able to build the control as part of a webpart but it needs to be done as a stand alone control that can be used on various webparts including the out of the box webparts like the WebPartPages:DataFormWebPart. Are there any good examples of building a custom control, deploying it to SharePoint and then using SharePoint designer to add that control to an existing web part?

validate control A depending on if control B has any value (diff types)

I've ready everything I can find on the built-in validators but can't figure out how to do the sort of validation I need on the client-side (I can do it on the server-side).  Business rule I want to enforce (review the gridview snippet below) is if user checks the CheckBox_EditLifeCycleRpt control but doesn't enter a value in the TextBox_LifeExpectancy control then the validation should fail.  <asp:TemplateField HeaderText="Life Expect*" SortExpression="LifeExpectancy"> <EditItemTemplate> <asp:TextBox ID="TextBox_LifeExpectancy" runat="server" Text='<%# Bind("LifeExpectancy") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label_LifeExpectancy" runat="server" Text='<%# Bind("LifeExpectancy") %>'></asp:Label> </ItemTemplate> <ControlStyle Width="50px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Life Cycle Rpt" SortExpression="LifeCycleRpt"> <EditItemTemplate> <asp:CheckBox ID="CheckBox_EditLifeCycleRpt" runat="server" Checked='<%# Bind("LifeCycleRpt") %>' /> </EditItemTemplate&g

Adding a custom control to the SharePoint 2010 Team Site Wiki Page Template ( wkpstd.aspx ) programm

Topic This is maybe my last post about the Team Site Wiki Page customization with the aim of exceeding its limitations. This time we are going to customize the unique template ( wkpstd.aspx) by replacing the control that renders the editable content by a custom one. In this post example, we will take advantage of the use of this custom control to render not editable additional contents, for instance, a header and a footer that could be the same for a specific Wiki Page Library. Of course, we are not going to really customize the template, but we are going to use a delegate control to replace the control at runtime. Here are the screen shots of the result: We can see a non editable Header and Footer on the Team Site Wiki Page In edit mode these additional contents are not rendered, but we can add new content as usual And of course, after having saved the page, the new content is rendered wtih the non editable Header and Footer. Steps required   If you look at the Team Site Wiki Page template, wkpstd.aspx, you can see the control that is rendering the editable content/ <SharePoint:EmbeddedFormField ID="WikiField" FieldName="WikiField" ControlMode="Display" runat="server" /> We are first going to create a custom EmbeddedFormField control Then, we are going to use a delegate control to replace the native EmbeddedFor

Sharepoint 2010 BI Center The DataSourceID of 'TopNavigationMenu V4' must be the ID of a control o

Dear Experts, I had installed SharePoint 2010 Foundation in my Windows 7 64 bit OS.  It did not have performance point server so, I later installed SharePoint 2010 Server Enterprise Version. But when I created a Business Intelligence Site Collection. I am getting this error: The DataSourceID of 'TopNavigationMenu V4' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found. Please help. Thanks & Best Regards, Benn  Bennz

Unable to add filter to a sharepoint DateTime Column

Hi ,I have a DateTime column in  a List. When I try to create a view the column doesnt appear in the folter Column List.When i create a calculated column out of the DateTime Column, the new calculated column appears in the Filter Column ListCan any one explain why?ThanksSrila

Validate a People Picker control

Hi,I would like to validate a People Editor field. I have tried using the property Allow Empty, but unfortunatly it doesnt work. I have used a Required field validator. Luckily it works to some extent. But the problem starts if there is any postback happening on the page. After the postback, it takes the value to be empty even if there is an entry in the control.Could anyone help me if there is any perticular property to be enabled or any other solution to acheive the validations on People Editor Control Raj

SharePoint DateTime

Im looking for an easy way of getting from sharepoint list datetime field into System.DateTime type  

AJAX tabcontainer, User Control and Sharepoint UserProfile

Hi All, I am working on following requirement. There is AJAX control, tabcontainer which is added in a user control which inturn is loaded in a sharepoint web part. Controls added int the tabcontainer include textboxes, a drop downbox and a button.On Page load I am connecting to sharepoint logged in user profile and display the information in the tabcontainer. I have kept provision to change the values for some fields which the user can change. On click of submit button the data should get saved to the same user profile and the tabcontainer should get refreshed with the new values entered. Problem Faced: On Page load all the values get populated to the controls placed in tabcontainer. But when I do any change in the control and click on submit, the changed values are not getting displayed instead old values are retained. Please help me in handling postback event. Following is the piece of code on page load and submit button protected void Page_Load(object sender, EventArgs e)         {             using (SPSite ospSite = new SPSite("http://omistestsrv:1995"))             {                 try           
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend