Archive

Archive for December, 2012

2012 in review

December 31, 2012 Leave a comment

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

19,000 people fit into the new Barclays Center to see Jay-Z perform. This blog was viewed about 120,000 times in 2012. If it were a concert at the Barclays Center, it would take about 6 sold-out performances for that many people to see it.

Click here to see the complete report.

Categories: Uncategorized

Programmatically Get List of Document Libraries in SharePoint 2010

December 17, 2012 Leave a comment

Hi all,

try this example to get a list of all Document Libraries in SharePoint 2010 Programmatically

1) Open VS2010 and create a new Empty Sharepoint Project

2) Right click on the project and Select Add New item then select Visual User Control and give it any name

3) From Toolbox drag DropdownList into Visual User Control and set ID=”ddl_List”

4) In Code behind add the following code


using (SPSite site = new SPContext.Current.Site)
 {
 using (SPWeb web = site.OpenWeb())
 {
 SPListCollection ListColl = web.Lists;
 foreach (SPList _lst in ListColl)
 {
 if (_lst.BaseTemplate == SPListTemplateType.DocumentLibrary)
 {
ddl_List.Items.Add(_lst.Title);
 }
 }
 }
 }

5) Build and Deploy the project

Hope this helps

Good Luck

Hope this helps

Categories: SharePoint 2010

Get Day List between Two Days in SQL Server

December 17, 2012 Leave a comment

Hi all,

try this example to get days list between two days in SQL Server


create function [dbo].[Fn_GetAllDays]
(
@startDate DATETIME,
@endDate DATETIME
)
RETURNS @Days TABLE (
 [Day] datetime
)
begin
WITH dates(Date) AS
(
 SELECT @startdate as Date
 UNION ALL
 SELECT DATEADD(d,1,[Date])
 FROM dates
 WHERE DATE < @enddate
)

insert into @Days
SELECT Date
FROM dates
OPTION (MAXRECURSION 0)

return;
end

and to use this function

select * from dbo.Fn_GetAllDays ('2011-01-01','2011-01-15')

Hope this helps

Good Luck.

Categories: SQL Server

Enable Status List in SharePoint 2010

December 16, 2012 Leave a comment

Hi all,

If you want to enable Status List in SharePoint 2010 follow the following steps

Go to site actions ->site features -> Manage site features -> enable “SharePoint Server Enterprise Site Features”.

Then you will be able to see the status list template and can create it.

Hope this helps

Good Luck

Categories: SharePoint 2010

Get Calculated Age in SharePoint 2010

December 13, 2012 Leave a comment

Hi all,

try this example to Calculate Age from Birthdate in SharePoint using Calculated Column

1) Create  SharePoint List and Add new Column Called BirthDate with Type DateTime and also add new Column Called Today with Type Text , and Add a new Column called Age with Type Calculated Column and In Formula type : =DATEDIF(BirthDate,Today,”Y”) then Ok

2) Delete Column Today from List

3) Now Add Rows in your List and you will Get Age Calculated when you add Bithdate.

for more information check this

Hope this helps

Good Luck

Categories: SharePoint 2010

Create Countdown timer before Download File in ASP.Net

December 13, 2012 Leave a comment

Hi all,

try this example to Create Countdown timer before Download File in ASP.Net

1) Open VS 2008 and create a new website

2) Add new Web Page and add this Javascript code


<script type="text/javascript">
 //Count to 8 seconds
 var c = 8;
 window.onload = function(){
 countDown(); //Execute the method
 }
 function countDown()
 {
 c -= 1;
 if(c>=0)
 {
 document.getElementById("timer").innerHTML = " in " + c + " seconds";
 }
 else
 {
 document.getElementById("timer").innerHTML = "Now";
 download();
 return;
 }
 var counter2 = setTimeout("countDown()",1000);
 return;
 }
 function download(){
 var ele = document.createElement('iframe');
 ele.src = "http://4rapiddev.com/wp-content/plugins/download-monitor/download.php?id=php-manage-session.zip";
 ele.style.display = "none";
 document.body.appendChild(ele);
 }
</script>

and add this HTML code inside your page


<div style="margin-left: 20px;">
 <h2>
 Thanks for trying our page!</h2>
 <br />
 <h3>
 An downloadable will be started <span id="timer"></span>.</h3>
</div>

Try it now

Hope this helps

Thank you

Categories: ASP.Net, Javascript

Get Time Only from DateTime in SQL Server

December 10, 2012 Leave a comment

Hi all ,

Try this example to get time only from DateTime in SQL Server

select convert(varchar(10),getdate(),108),Convert(VarChar(13),getdate(),114)

To Get Total Second from DateTime try this Query

SELECT (DATEPART(hour, getdate()) * 360) +(DATEPART(minute, getdate()) * 60) + DATEPART(second, getdate())

Hope this helps

Good Luck

Categories: SQL Server