Saturday, February 18, 2012

Fetch / Get Current Date from SQL Server in a specific format

Hi All,
      Working on Saturday is really a pain...Phew...!!!!...

I came across a requirement where you have to get a Current Date from Sql Server in the following format :

DD - MM - YYYY (note the hyphen in between)


So, here is the script with the Sql Server Replace function...:



Select Replace(Convert(varchar(11),Getdate(),106),' ',' - ') as 'Today'





And the Result is :





Thanks,
Nitin Sharma

Happy Coding....

Friday, February 17, 2012

Add Twitter and Facebook like Social Sites link to ASP.NET WebSite

Hi All,
      This is my first post of the year 2012.
I came across one requirement in my recent project in which where i do have to add two share buttons for two most popular social networking sites Facebook and Twitter.

I found this HTML code to be placed in any asp.net site . Below is the code:

<a href="http://twitter.com/home?status=" target="_blank" onclick="window.open(this.href, this.target,'height=500px,width=400px'); return false">

  <img src="Images/twitter.png" alt="Share on Twitter" />

a>

<a href="http://www.facebook.com/connect/prompt_feed.php?&message=" target="_blank" onclick="window.open(this.href, this.target,'height=500px,width=400px'); return false">
  
<img src="Images/facebook.png" alt="Share on Twitter" />

a>




Thats it...and  you are ready with the share button.

Below is the snapshot of  the rendered page after click on facebook and twitter image link.

Clicking on Twitter image opens the below page as a pop up:


Clicking on Facebook image opens the below page as a pop up:





This is for sharing your own  on these two networking sites but not shareing the link or any other outside matter.


Thanks,
Nitin Sharma

Happy Coding..!!!