Posts

Showing posts from March, 2012

Get The Details Of Identity Columns in a Table in sql server

To get the current value: SELECT IDENT_CURRENT('Table Name') As currentValue To get the Identitity seed: SELECT IDENT_SEED('Table Name')As identitySeed To get the Identity Increement SELECT IDENT_INCR('Table Name') As IdendityIncreement

Calling server side functions using ajax in javascript

In the javascript side <script> function insertValue(){  $.ajax({                             type: "POST",                             url: "Default.aspx/serverFunction",                             data: '{path: "' + path + '"}',                             contentType: "application/json; charset=utf-8",                       ...

open a new window with button inside an ajax update panel

 ScriptManager.RegisterClientScriptBlock(UpdatePanel1, UpdatePanel1.GetType(), "Any Name you Like", "Window.open('default.aspx','','height=100,width=100');", true);

Simple string encoding and decoding in c#

public string Decode(string sData)         {             System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();             System.Text.Decoder utf8Decode = encoder.GetDecoder();             byte[] todecode_byte = Convert.FromBase64String(sData);             int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);             char[] decoded_char = new char[charCount];             utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);             string result = new String(decoded_char);     ...

Sending mail in asp.net using gmail gateway

using System.Net.Mail; ......... ......... public string SendMail(string uname,string password, string To, string Subject, string Body)     {         string fromid = uname;         string mypass = password;         try         {             //Create Mail Message Object with content that you want to send with mail.             MailMessage MyMailMessage = new MailMessage(fromid, To, Subject, Body);             MyMailMessage.IsBodyHtml = true;             //Proper Authentication Details need to be passed when sending email from gmail             Syst...

Shuffling a sequence of numbers in an array.

here this code will randomly shuffle consecutive series of numbers, from 1 up to 1000. int[] theArray = new int[1000];             int i = 0;             while (i < theArray.Length)             {                 theArray[i] = ++i;             }             // Work backward, swapping the last unswapped entry with any of the             // remaining unswapped entries - including possibly itself.             // This is really just slightly complicated way of doing a random 'draw',         ...