Learning Curve…

Archive for the ‘Technical Articles’ Category

1. Vertical Scoll position at the bottom of screen

<script type=”text/javascript”>

    function init() {

      var scnWid, scnHei;

      scnWid = document.body.clientWidth;

      scnHei = document.body.clientHeight;

      self.scrollTo(scnWid, scnHei);

    }

    window.onload = init;

  </script>

2. Vertical Scroll position based on a control in the screen

    Below example set scroll position at the start of grid’s header

<script type=”text/javascript”>

    function init() {

      var scnWid, scnHei;

      scnWid = getElementPosition(‘gridName’).left;

      scnHei = getElementPosition(‘gridName’).top;

     self.scrollTo(scnWid, scnHei);

    }

    function getElementPosition(elemID) {

      var offsetTrail = document.getElementById(elemID);

      var offsetLeft = 0;

      var offsetTop = 0;

      while (offsetTrail) {

        offsetLeft += offsetTrail.offsetLeft;

        offsetTop += offsetTrail.offsetTop;

        offsetTrail = offsetTrail.offsetParent;

      }

      return { left: offsetLeft, top: offsetTop };

    }

    window.onload = init;

  </script>

Advertisements

The script to check if column exists and then renaming the column:-

IF EXISTS (SELECT * FROM sys.columns WHERE Name = N’OldColumnName’ AND Object_ID = Object_ID(N’TableName’))
BEGIN
   EXEC sp_RENAME ‘TableName.OldColumnName’ , ‘NewColumnName’, ‘COLUMN’
END

Style Code

Style

Format

Example

0 or 100 Default. Equivalent to not specifying a style code. mon dd yyyy hh:mmAM Sep 8 2007 9:00PM
1 USA date. mm/dd/yy 09-08-2007
2 ANSI date. yy.mm.dd 07-09-2008
3 UK / French date. dd/mm/yy 08-09-2007
4 German date. dd.mm.yy 08.09.07
5 Italian date. dd-mm-yy 08-09-2007
6 Abbreviated month. dd mmm yy 08-Sep-07
7 Abbreviated month. mmm dd, yy Sep 08, 07
8 or 108 24 hour time. HH:mm:ss 21:00:00
9 or 109 Default formatting with seconds and milliseconds appended. mon dd yyyy hh:mm:ss:fffAM Sep 8 2007 9:00:00:000PM
10 USA date with hyphen separators. mm-dd-yy 09-08-2007
11 Japanese date. yy/mm/dd 07-09-2008
12 ISO date. yymmdd 70908
13 or 113 European default with seconds and milliseconds. dd mon yyyy HH:mm:ss:fff 08 Sep 2007 21:00:00:000
14 or 114 24 hour time with milliseconds. HH:mm:ss:fff 21:00:00:000
20 or 120 ODBC canonical date and time. yyyy-mm-dd HH:mm:ss 08-09-2007 21:00
21 or 121 ODBC canonical date and time with milliseconds. yyyy-mm-dd HH:mm:ss.fff 00:00.0
101 USA date with century. mm/dd/yyyy 09-08-2007
102 ANSI date with century. yyyy.mm.dd 08-09-2007
103 UK / French date with century. dd/mm/yyyy 08-09-2007
104 German date with century. dd.mm.yyyy 08.09.2007
105 Italian date with century. dd-mm-yyyy 08-09-2007
106 Abbreviated month with century. dd mmm yyyy 08-Sep-07
107 Abbreviated month with century. mmm dd, yyyy Sep 08, 2007
110 USA date with hyphen separators and century. mm-dd-yyyy 09-08-2007
111 Japanese date with century. yyyy/mm/dd 08-09-2007
112 ISO date with century. yymmdd 20070908
126 ISO8601, for use in XML. yyy-mm-ddThh:mm:ss 2007-09-08T21:00:00

 

Eval is one-way, read only databinding.

Bind is two-way, read/write databinding.

You can check if constraints exist in a column in sql server  and if its not there you can alter table to add a constraint using below query :-

IF NOT EXISTS (SELECT  *  FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ConstraintsName]’))
    ALTER TABLE [dbo].[TableName] ADD  CONSTRAINT [ConstraintsName]  DEFAULT (newid()) FOR [ContactID]
GO

Happy Coding !!!

Good site to follow –

http://support.microsoft.com/kb/2006191

Namespace:-

using System.Web.Configuration;
using System.Net.Configuration;

Code:-

System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConiguration

(HttpContext.Current.Request.ApplicationPath);
System.Net.Configuration.MailSettingsSectionGroup settings = (System.Net.Configuration.MailSettingsSectionGroup)

config.GetSectionGroup(“system.net/mailSettings”);
string strfromMailID = settings.Smtp.From;

Happy Coding!!!


Author

Learning days (Calendar)

October 2017
M T W T F S S
« Jun    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 510,411 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: