Monthly Archives: January 2015

deploy infopath form in SharePoint

Guys, here is the powershell command to successfully deploy your infopath form (.xsn) file to Central Adminstration SharePoint using SP Management Shell.

1) Open SharePOint Management Shell as Run with Admin

2) write this command and click ok

Install-SPInfoPathFormTemplate -Path “C:\Users\hamad.nasir\Documents\InfoPathPublishedForm\MyInfoPathForm.xsn”

3) There will be a prompt which ask to perform the operation write YES and press enter

OR you can upload directly to CA – Manage form Templates if you don’t want to use above command.

Thanks

Compare Date in Jquery javascript

here is the easiest and best way to compare dates in Javascript in my opinion.

 Date.parse Return the number of milliseconds between January 1, 1970 and entered date in textbox


function CompareDate()

{
var todayDate = new Date();
//need to add one to get current month as it is start with 0
var todayMonth = todayDate.getMonth() + 1;
var todayDay = todayDate.getDate();
var todayYear = todayDate.getFullYear();
var todayDateText = todayDay + "/" + todayMonth + "/" + todayYear;

var myDate = $('#txtDate').val();

var todayToDate = Date.parse(todayDateText);
var myDateParsed = Date.parse(myDate);

if (myDateParsed < todayToDate) {
alert("date must be greater from today date.");
}
}

Save and display rich text box in SharePoint C#

Hi guys, today i’m posting how to work with rich text box control of SharePoint?

place control on your visual webpart as follows

<SharePoint:InputFormTextBox ID=”txtDesc” runat=”server” RichText=”true” RichTextMode=”FullHtml” TextMode=”MultiLine” />

richtextbox SharePoint

save it as we save the textbox value by using txtDesc.Text, this will save the contents as well as the html in SharePoint list field.

How to display it in the lable?

<asp:Label ID=”lblDescription” runat=”server”></asp:Label>

lblDescription.Text = Convert.ToString(listItem[0][“internalNameOfYourSharePointListfield”]);

rich text box in Label

value displaying in above figure.

Note: we can also attach image and to display it in the label as the same way i did.

Thanks