Validation of viewstate MAC failed.


Friday, December 2, 2011

Question : Getting this error, "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."

Solution :
In your web.config file, you will find this line.



Just replace this line with below line and all your problem solved.



Please send me your questions to me, if you have any..

Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Email: raj143svmit@gmail.com
Dobazaar (Dubai, UAE)
www.dobazaar.com

301 redirect "/Default.aspx" to "/" Root Asp.Net


Sunday, October 30, 2011

Question : How to use global.asax and do 301 redirect "/Default.aspx" to "/" Root ?
Answer :

Add below code in global.asax, thats it.


void Application_BeginRequest(object sender, EventArgs e)
    {
        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://induway.com"))
        {
            HttpContext.Current.Response.Status = "301 Moved Permanently";
            HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://induway.com/default.aspx", "http://www.induway.com"));
        }
    }



Let me know, if you have any query..


Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Email: raj143svmit@gmail.com
Dobazaar (Dubai, UAE)
www.dobazaar.com

Create, Read, and Detele Cookies in Javascript


Thursday, September 22, 2011

Hello Friends,

This post will explain you how you can create, read and delete the cookies in your webpage using Javascript.

Here is the code to create cookies,
In this below code, you can see, Cookies is Set to Name "RajeshCookie" and value is set to "Rajesh" and
its expire time is set to next month as shown in below code.


//for creating a cookie
<script type="text/javascript">
<!--
   var today = new Date();
   var nextMonth = new Date(today.getYear(), today.getMonth()+1, today.getDate());
   setCookie("RajeshCookie", "Rajesh", nextMonth);
// -->
</script>


Here is the code to read cookies,


//for reading the cookie
<script type="text/javascript">
<!--
      var szName = getCookie("RajeshCookie");
// -->
</script>


Here is the code to Delete cookies,


//for deleting the cookie
<script type="text/javascript">
<!--
      deleteCookie('RajeshCookie');
// -->
</script>


Let me know, if you have any query..




Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com 
 
 


Change ConnectionString when database server is not working




Hello Friends,

Sometime, you might have notice that, your hosting server is working fine but your database is not working due to which you
might be getting error on website and you might be loosing visitor and ranking in website..

This post is regarding that only, you can manage this issue by two database.

You can have two database at different server and you can call this in global.asax

first you can make ping to first database everytime and if its working you can call first server database and
if you find any issue or server is not working then you can switch to second server using below code..



    Dim connStatus As String
        Dim png As New Ping()
        Dim pr As PingReply = png.Send("221.256.357.36")
        connStatus = pr.Status.ToString()
        '--------------------

        If connStatus = "Success" Then
            If ConnString = "OldConnection" Then
                If ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            Else
                If ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            End If
        Else
            If ConnString = "newconnection" Then
                If ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            Else
                If ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            End If
        End If


Let me know, if you have any query..




Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com 

SQL Server Query to Search Text in Stored Procedure


Monday, September 12, 2011

Hello Friends,

This post contains one query, by using that you can make search for any text in your Stored
Procedure Or Triggers,

Here is the query..


Use TempDatabase

SELECT ROUTINE_NAME, ROUTINE_DEFINITION 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_DEFINITION LIKE '%proc_%' 
AND ROUTINE_TYPE='PROCEDURE'



Frist Select the Database by Use prefix,like below
use TempDatabase

Then copy this query in your query browser of SQL server,

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%proc_%'
AND ROUTINE_TYPE='PROCEDURE'

and just press F5, to run this query

Let me know, if you have any query..



Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com 
 
 

Fixed First Column and Header of Table and Scroll other Column


Wednesday, August 3, 2011

Hello Friends,

This is Demo to show you Horizontal and Vertical scroll of table by column and row and fixed First column,
You can check out demo and find source code below of demo..Please post any queries if you have ..

Demo


Header1
Header2
Header3
Header4
Header5
Header row1
Header row2
Header row3
Header row4
Header row5
Header row6
Header row7
Header row8
Header row9
Row1Col1Row1Col2Row1Col3Row1Col4Row1Col5
Row2Col1Row2Col2Row2Col3Row2Col4Row2Col5
Row3Col1Row3Col2Row3Col3Row3Col4Row3Col5
Row4Col1Row4Col2Row4Col3Row4Col4Row4Col5
Row5Col1Row5Col2Row5Col3Row5Col4Row5Col5
Row6Col1Row6Col2Row6Col3Row6Col4Row6Col5
Row7Col1Row7Col2Row7Col3Row7Col4Row7Col5
Row8Col1Row8Col2Row8Col3Row8Col4Row8Col5
Row9Col1Row9Col2Row9Col3Row9Col4Row9Col5


<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>

$(document).ready(function(){
  fnAdjustTable();
});

fnAdjustTable = function(){

  var colCount = $('#firstTr>td').length; //get total number of column

  var m = 0;
  var n = 0;
  var brow = 'mozilla';
  
  jQuery.each(jQuery.browser, function(i, val) {
    if(val == true){
      brow = i.toString();
    }
  });
  
  $('.tableHeader').each(function(i){
    if (m < colCount){

      if (brow == 'mozilla'){
        $('#firstTd').css("width",$('.tableFirstCol').innerWidth());//for adjusting first td
        $(this).css('width',$('#table_div td:eq('+m+')').innerWidth());//for assigning width to table Header div
      }
      else if (brow == 'msie'){
        $('#firstTd').css("width",$('.tableFirstCol').width());
        $(this).css('width',$('#table_div td:eq('+m+')').width()-2);//In IE there is difference of 2 px
      }
      else if (brow == 'safari'){
        $('#firstTd').css("width",$('.tableFirstCol').width());
        $(this).css('width',$('#table_div td:eq('+m+')').width());
      }
      else {
        $('#firstTd').css("width",$('.tableFirstCol').width());
        $(this).css('width',$('#table_div td:eq('+m+')').innerWidth());
      }
    }
    m++;
  });

  $('.tableFirstCol').each(function(i){
    if(brow == 'mozilla'){
      $(this).css('height',$('#table_div td:eq('+colCount*n+')').outerHeight());//for providing height using scrollable table column height
    }
    else if(brow == 'msie'){
      $(this).css('height',$('#table_div td:eq('+colCount*n+')').innerHeight()-2);
    }
    else {
      $(this).css('height',$('#table_div td:eq('+colCount*n+')').height());
    }
    n++;
  });

}

//function to support scrolling of title and first column
fnScroll = function(){
  $('#divHeader').scrollLeft($('#table_div').scrollLeft());
  $('#firstcol').scrollTop($('#table_div').scrollTop());
}

</script>
<style type="text/css" charset="utf-8">/* See license.txt for terms of usage */

/** reset styling **/

.firebugResetStyles {

    z-index: 2147483646 !important;

    top: 0 !important;

    left: 0 !important;

    display: block !important;

    border: 0 none !important;

    margin: 0 !important;

    padding: 0 !important;

    outline: 0 !important;

    min-width: 0 !important;

    max-width: none !important;

    min-height: 0 !important;

    max-height: none !important;

    position: fixed !important;

    -moz-transform: rotate(0deg) !important;

    -moz-transform-origin: 50% 50% !important;

    -moz-border-radius: 0 !important;

    -moz-box-shadow: none !important;

    background-image: none !important;

    pointer-events: none !important;

}



.firebugBlockBackgroundColor {

    background-color: transparent !important;

}



.firebugResetStyles:before, .firebugResetStyles:after {

    content: "" !important;

}

/**actual styling to be modified by firebug theme**/

.firebugCanvas {

    display: none !important;

}



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.firebugLayoutBox {

    width: auto !important;

    position: static !important;

}



.firebugLayoutBoxOffset {

    opacity: 0.8 !important;

    position: fixed !important;

}



.firebugLayoutLine {

    opacity: 0.4 !important;

    background-color: #000000 !important;

}



.firebugLayoutLineLeft, .firebugLayoutLineRight {

    width: 1px !important;

    height: 100% !important;

}



.firebugLayoutLineTop, .firebugLayoutLineBottom {

    width: 100% !important;

    height: 1px !important;

}



.firebugLayoutLineTop {

    margin-top: -1px !important;

    border-top: 1px solid #999999 !important;

}



.firebugLayoutLineRight {

    border-right: 1px solid #999999 !important;

}



.firebugLayoutLineBottom {

    border-bottom: 1px solid #999999 !important;

}



.firebugLayoutLineLeft {

    margin-left: -1px !important;

    border-left: 1px solid #999999 !important;

}



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.firebugLayoutBoxParent {

    border-top: 0 none !important;

    border-right: 1px dashed #E00 !important;

    border-bottom: 1px dashed #E00 !important;

    border-left: 0 none !important;

    position: fixed !important;

    width: auto !important;

}



.firebugRuler{

    position: absolute !important;

}



.firebugRulerH {

    top: -15px !important;

    left: 0 !important;

    width: 100% !important;

    height: 14px !important;

    background: url("data:image/png,%89PNG%0D%0A%1A%0A%0DIHDR%13%88%0E%08%02L%25a%0A%04gAMA%D6%D8%D4OX2%19tEXtSoftwareAdobe%20ImageReadyq%C9e%3C%04%F8IDATx%DA%EC%DD%D1n%E2%3AE%D1%80%F8%FF%EF%E2%AF2%95%D0D4%0E%C1%14%B0%8Fa-%E9%3E%CC%9C%87n%B9%81%A6W0%1C%A6i%9A%E7y%0As8%1CT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9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95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5J%95*U%AAT%A9R%A5*%AAj%FD%C6%D4%5Eo%90%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5%86%AF%1B%9F%98%DA%EBm%BBV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%ADV%AB%D5j%B5Z%AD%D6%E4%F58%01%40%85%7F%02%0C8%C2%D0H%16j%8FXIEND%AEB%60%82") repeat-x !important;

    border-top: 1px solid #BBBBBB !important;

    border-right: 1px dashed #BBBBBB !important;

    border-bottom: 1px solid #000000 !important;

}



.firebugRulerV {

    top: 0 !important;

    left: -15px !important;

    width: 14px !important;

    height: 100% !important;

    background: url("data:image/png,%89PNG%0D%0A%1A%0A%0DIHDR%0E%13%88%08%02%0E%F5%CB%10%04gAMA%D6%D8%D4OX2%19tEXtSoftwareAdobe%20ImageReadyq%C9e%3C%06~IDATx%DA%EC%DD%D1v%A20%14%40Qt%F1%FF%FF%E4%97%D9%07%3BT%19%92%DC%40(%90%EEy%9A5%CB%B6%E8%F6%9Ac%A4%CC0%84%FF%DC%9E%CF%E7%E3%F1%88%DE4%F8%5D%C7%9F%2F%BA%DD%5E%7FI%7D%F18%DDn%BA%C5%FB%DF%97%BFk%F2%10%FF%FD%B4%F2M%A7%FB%FD%FD%B3%22%07p%8F%3F%AE%E3%F4S%8A%8F%40%EEq%9D%BE8D%F0%0EY%A1Uq%B7%EA%1F%81%88V%E8X%3F%B4%CEy%B7h%D1%A2E%EBohU%FC%D9%AF2fO%8BBeD%BE%F7X%0C%97%A4%D6b7%2Ck%A5%12%E3%9B%60v%B7r%C7%1AI%8C%BD%2B%23rc0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%96%D9%A2E%8B%16-Z*%83%96%D9%A2E%8B%16-Z%B4T%86%D9%A2E%8B%16-Z%B4T%06-%B3E%8B%16-Z%B4%AE%A4%F5%25%C0%DE%BF%5C'%0F%DA%B8qIEND%AEB%60%82") repeat-y !important;

    border-left: 1px solid #BBBBBB !important;

    border-right: 1px solid #000000 !important;

    border-bottom: 1px dashed #BBBBBB !important;

}



.overflowRulerX > .firebugRulerV {

    left: 0 !important;

}



.overflowRulerY > .firebugRulerH {

    top: 0 !important;

}



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.fbProxyElement {

    position: absolute !important;

    pointer-events: auto !important;

}</style></head>





<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tbody><tr>
    <td style="width: 196px;" id="firstTd">
    </td>
    <td>
      <div id="divHeader" style="overflow:hidden;width:284px;">
        <table border="1" cellpadding="0" cellspacing="0">
          <tbody><tr>
            <td>
              <div style="width: 69px;" class="tableHeader">Header1</div>
            </td>
            <td>
              <div style="width: 69px;" class="tableHeader">Header2</div>
            </td>
            <td>
              <div style="width: 213px;" class="tableHeader">Header3</div>
            </td>
            <td>
              <div style="width: 69px;" class="tableHeader">Header4</div>
            </td>
            <td>
              <div style="width: 69px;" class="tableHeader">Header5</div>
            </td>
          </tr>
        </tbody></table>
      </div>
    </td>
  </tr>
  <tr>
  
    <td valign="top">
      <div id="firstcol" style="overflow: hidden;height:80px">
        <table border="1" cellpadding="0" cellspacing="0" width="200px">
          <tbody><tr>
            <td style="height: 22px;" class="tableFirstCol">Header row1 </td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row2</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row3</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row4</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row5</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row6</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row7</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row8</td>
          </tr>
          <tr>
            <td style="height: 22px;" class="tableFirstCol">Header row9</td>
          </tr>
        </tbody></table>
      </div>
    </td>
    
    <td valign="top">
      <div id="table_div" style="overflow: scroll;width:300px;height:100px;position:relative" onscroll="fnScroll()">
        <table border="1" cellpadding="0" cellspacing="0" width="500px">
          <tbody><tr id="firstTr">
            <td>Row1Col1</td>
            <td>Row1Col2</td>
            <td>Row1Col3</td>
            <td>Row1Col4</td>
            <td>Row1Col5</td>
          </tr>
          <tr>
            <td>Row2Col1</td>
            <td>Row2Col2</td>
            <td>Row2Col3</td>
            <td>Row2Col4</td>
            <td>Row2Col5</td>
          </tr>
          <tr>
            <td>Row3Col1</td>
            <td>Row3Col2</td>
            <td>Row3Col3</td>
            <td>Row3Col4</td>
            <td>Row3Col5</td>
          </tr>
          <tr>
            <td>Row4Col1</td>
            <td>Row4Col2</td>
            <td>Row4Col3</td>
            <td>Row4Col4</td>
            <td>Row4Col5</td>
          </tr>
          <tr>
            <td>Row5Col1</td>
            <td>Row5Col2</td>
            <td>Row5Col3</td>
            <td>Row5Col4</td>
            <td>Row5Col5</td>
          </tr>
          <tr>
            <td>Row6Col1</td>
            <td>Row6Col2</td>
            <td>Row6Col3</td>
            <td>Row6Col4</td>
            <td>Row6Col5</td>
          </tr>
          <tr>
            <td>Row7Col1</td>
            <td>Row7Col2</td>
            <td>Row7Col3</td>
            <td>Row7Col4</td>
            <td>Row7Col5</td>
          </tr>
          <tr>
            <td>Row8Col1</td>
            <td>Row8Col2</td>
            <td>Row8Col3</td>
            <td>Row8Col4</td>
            <td>Row8Col5</td>
          </tr>
          <tr>
            <td>Row9Col1</td>
            <td>Row9Col2</td>
            <td>Row9Col3</td>
            <td>Row9Col4</td>
            <td>Row9Col5</td>
          </tr>
        </tbody></table>
      </div>
    </td>
  </tr>
</tbody></table>
</body></html>


Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com

Find Today is Sunday or Not by Jquery





Hello Friends,

Please find below demo and code to find date is sunday or not, please check it out.


Demo



Year : (only interger)

Month : (only interger)

Date : (only interger)






<html>
<head>
<title>jQuery test page</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

<script type="text/javascript">

function getsunday(date) {
        var day = date.getDay();
        return [(day != 0), ''];
    }


function FindTodayisSunday() {
            if(getsunday(new Date(document.getElementById('txtyear').value,document.getElementById('txtmonth').value-1,document.getElementById('txtdate').value))!='true,'){
            document.getElementById('error').innerHTML="Today is sunday.";
            document.getElementById("error").setAttribute("style", "color:Green;"); 
            }
            else{
            document.getElementById('error').innerHTML="Today is not sunday";
            document.getElementById("error").setAttribute("style", "color:Red;"); 
            }
}
</script>
</head>
<body>
Year : <input type="text" id="txtyear"/><i>(only interger)</i><br />
Month : <input type="text" id="txtmonth"/><i>(only interger)</i><br />
Date : <input type="text" id="txtdate" onblur="FindTodayisSunday()" /><i>(only interger)</i><br />
<span id="error"></span>
</body>
</html>




Thanks
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com

Alpha Numeric And Few Special Character Allowed Validation




Hello Friends,

jQuery provides you alphanumeric validation or only Special Character validation, below code will help you validate your textbox with alphanumeric and also allow few special character, you can see regex pattern below, you can add your special character which you want to allow..you can also see live demo by entering your text in below textbox.. 


Demo



Enter Name :


Note : Few character allowed (!,\-,.,&,*,#,@,/)




<html>
<head>
<title>jQuery test page</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

<script type="text/javascript">
function loadContent() {

            if(validate()){
            document.getElementById('error').innerHTML="Validate Success.";
            document.getElementById("error").setAttribute("style", "color:Green;"); 
            }
            else{
            document.getElementById('error').innerHTML="Not Validate, its wrong.";
            document.getElementById("error").setAttribute("style", "color:Red;"); 
            }
}

function validate()
{
    return /^([a-zA-Z 0-9]([a-zA-Z 0-9\s\[\]\!\(\)\-\.\&\*\#\@/\\(/)/)])+$)/.test(document.getElementById('txtcheck').value);
}
</script>
</head>
<body>
Enter Name : <input type="text" id="txtcheck" onblur="loadContent()" />
<span id="error"></span><br />
Note : Few character allowed (!,\-,.,&,*,#,@,/)
</body>
</html>





Thanks
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com

All the Operation of Getdate()


Friday, July 15, 2011

Hello developers,

Please find all the operation done on particular getdate() function,



--Get today date
select getdate()

--Get Day
select DATENAME (DW,GETDATE())

--Get date of sundays in month
declare @d1 datetime, @d2 datetime
--select @d1 = '5/1/2009'
--,@d2= '5/31/2009'

select @d1 = CONVERT(datetime, DATEADD(dd,-(DAY(DATEADD(mm,1,GETDATE()))-1),DATEADD(mm,0,GETDATE())), 103)
,@d2= CONVERT(datetime, DATEADD(d, -DAY(DATEADD(m,1,getdate())),DATEADD(m,1,getdate())), 103)

;with dates ( date )
as
(
select @d1
union all
select dateadd(d,1,date)
from dates
where date < @d2
)
select day(date) as sundaydate from dates where datename(dw,date) = 'Sunday'


--Get total number of days in month
select datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year(getdate()) as varchar)+'-'+cast(month(getdate()) as varchar)+'-01' as datetime))))

--First Day of month
SELECT DAY(DATEADD(dd,-(DAY(DATEADD(mm,1,GETDATE()))-1),DATEADD(mm,0,GETDATE())))

--Last Day of month
SELECT DAY(DATEADD(d, -DAY(DATEADD(m,1,getdate())),DATEADD(m,1,getdate())))


--First Date of month
SELECT CONVERT(VARCHAR(10), DATEADD(dd,-(DAY(DATEADD(mm,1,GETDATE()))-1),DATEADD(mm,0,GETDATE())), 103)

--Last Date of month
SELECT CONVERT(VARCHAR(10), DATEADD(d, -DAY(DATEADD(m,1,getdate())),DATEADD(m,1,getdate())), 103)

--Get date of date
select DAY(getdate())



Thanks
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com

e-Procurement Technologies Ltd (India)
www.abcprocure.com

File 3


Friday, July 8, 2011

1) Define some facts about Temporary table and there types
ans: Temporary table name is limited t 116 characters. Local temporary table created with single # and then name of table.
And this table is to be deleted explicitly and if it is created in store procedure it will be dropped at the end of store procedure.
On the other hand if are talking abut Global variable tables start with ## and these are dropped on the session ends.
And some more facts about the Temporary tables is that these cannot be partitioned and we c
annot create key constraints to these tables and one more thing is that we cannot create user-defined data types in tempdb.

2) What are the different index configurations a table can have
ans: (1)No indexes
(2)A clustered index
(3)A clustered index and many nonclustered indexes
(4)A nonclustered index
(5)Many nonclustered indexes

3)What do you mean by KEYSET Cursor
ans: KEYSET Cursor uses the set of keys that are primary key or we can saw uniquely identify the cursor's rows.
SQL Server uses a table in tempdb to store keyset. The KEYSET cursor helps to updates non key values from being made through this cursor,
but when inserts made by other users are not visible. Updates nonkey values made by other users are visible as the owner scrolls around the cursor,
but updates key values made by other users are not visible.

3)Here are some instruction when creating a store procedure to increase speed
ans: Here are the some good tips when creating a store procedure

(1)Always use ANSI92 syntax avoid to use the old syntax.
(2)Use SQL keyword in capital letters to increase readability.

(3)Use few possible variables to increase cache memory.
(4)Try to avoid dynamic queries if we are not using dynamic query there is no recompilation of execution plan but on the other side
if we are using dynamic query every time we need recompile of plan.

(5)Use SET NOCOUNT ON this will helps us to get number of row effected without network traffic.
(6)To avoid recompilations use OPTION KEEPFIXED PLAN.

(7)In Select and Set use select to assign value to variable it is much faster than multiple set statement.
(8)Try to avoid IN. IN counts Null values so use EXISTA there. EXISTS which return only boolean value and IN return heavier result than EXISTS.

(9)In CAST and CONVERT always try to use CAST it is ASNI92 standard.Use convert in case of datetime.
(10)Avoid Distinct and Order by clause.These class needs extra space.

(11)Avoid cursor so use while loop for that and temparory tables.
(12)Avoid to use * in select statement.

(13)Avoid correlated sub queries.
(14)Avoid select * into for large tables it locks the system objects.

(15)Avoid temporary tables because it will recompile the procedure.
4)Size of Clustered NonClustered in 2005 and 2008
ans: In SQL 2005 and earlier there was a limitation of 250 indexes per table, one clustered and 249 non-clustered. In SQL 2008,
with the addition of filtered indexes, that limitation was increased to 1000, one clustered and 999 non-clustered indexes.

5)Difference between Set and Select
ans: Set is a ANSI standard for variable assignment.

Select is a Non-ANSI standard when assigning variables.
We can assign only one variable at a time

We can assign multiple variable at a time
When assigning from a query that returns more than one value, SET will fail with an error.

When assigning from a query that returns more than one value, SELECT will assign the last value returned by the query and hide the fact that the query returned

6)How many different locks in SQL SERVER
ans: (1)Intent

(2)shared
(3)Update

(4)Exclusive
(5)Schema

(6)Bulk Update
7)What is the use of OLAP
ans: OLAP(On-Line Analytical Processing) is useful because it provides fast and interactive access to aggregated data and the ability to drill down to detail.

8)What do you mean by Filtered indexes
ans:Filtered indexes are a new feature in SQL 2008 and they allow for an index to contain only some of the rows in the table. Prior to this,
an index would always have, at the leaf level, the same number of rows as the table. With filtered indexes, an index can be based on just a subset of the rows.
When creating a filtered index, a predicate is specified as part of the index creation statement. There are several limitations on this predicate. The comparison ca
nnot reference a computed column, a column that is declared as a user-defined type, a spatial column or a hierarchyid column.
A clustered index cannot be filtered as it is the actual table.

9)What are Sparse Columns in Sql Server2008
ans:sparse column is a tool that helps to reduce amount of physical storage used in a database.
These are ordinary columns that have an optimized storage for all null values.SPARSE column are better at managing NULL and ZERO values in SQL Server.
It does not take any space in database at all.

10)Difference between Triggers and Storedprocedures
Triggers are basically used to implement business rules.Triggers is also similar to stored procedures.
The difference is that it can be activated when data is added or edited or deleted from a table in a database.
Triggers are special kind of stored procedures that get executed automatically when an INSERT,UPDATE or DELETE operation takes place on a table.

11)Diffrence between temp table and table variable
(1)Temp Tables are created in the SQL Server TEMPDB database and therefore require more IO resources and locking.
Table Variables and Derived Tables are created in memory.

(2)Temp Tables will generally perform better for large amounts of data that can be worked on using parallelism whereas
Table Variables are best used for small amounts of data (I use a rule of thumb of 100 or less rows) where parallelism would not provide
a significant performance improvement.
(3)You cannot use a stored procedure to insert data into a Table Variable or Derived Table.
For example, the following will work: INSERT INTO #MyTempTable EXEC dbo.GetPolicies_sp whereas the following will generate an error:
INSERT INTO @MyTableVariable EXEC dbo.GetPolicies_sp.

(4)Derived Tables can only be created from a SELECT statement but can be used within an Insert, Update, or Delete statement.
(5) In order of scope endurance, Temp Tables extend the furthest in scope, followed by Table Variables, and finally Derived Tables.

12)Diffrence between varchar and nvarchar
An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used
because it takes up less space. I believe this is not the correct answer. Codepage incompatabilities are a pain, and Unicode is the cure for codepage problems.
With cheap disk and memory nowadays, there is really no reason to waste time mucking around with code pages anymore.

13)What is SQL injection
SQL injection is a security vulnerability that occurs in the database layer of an application. The vulnerability is present when user input is
either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed.
It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.

14)What are Checkpoint in SQL Server
When we done operation on SQL SERVER that is not commited directly to the database.All operation must be logged in to Transaction Log files after that
they should be done on to the main database.CheckPoint are the point which alert Sql Server to save all the data to main database if no Check point
is there then log files get full we can use Checkpoint command to commit all data in the SQL SERVER.When we stop the SQL Server
it will take long time because Checkpoint is also fired.

15)What is the difference between UNION ALL Statement and UNION
The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that
because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist.

16)Write some disadvantage of Cursor
Cursor plays there row quite nicely but although there are some disadvantage of Cursor . Because we know cursor doing roundtrip it will make
network line busy and also make time consuming methods. First of all select query gernate output and after that cursor goes one by one so roundtrip
happen.Another disadvange of cursor are ther are too costly because they require lot of resources and temporary storage so network is quite busy.

17)What is different in Rules and Constraints
Rules and Constraints are similar in functionality but there is a An little diffrence between them.Rules are used for backward compatibility .
One the most exclusive diffrence is that we an bind rules to a datatypes whereas constraints are bound only to columns.So we can create our own
datatype with the help of Rules and get the input according to that.

18)What is the difference between a HAVING CLAUSE and a WHERE CLAUSE
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the
GROUP BY function in a query.

19)What are the advantage of User Defined function over store procedure
There are no of benefits of SQL Server User-Defined functions.Some of these are here we can use these functions in so many different places with
comparison to SQL Server stored procedure.Two of user define function acts like a table (Inline and Multi-statement functions) helps developers to
reduce the code and break complex logic in short code blocks.On the other hand Scalar User-Defined Function have ability so that we use this function
anywhere where we
need some single value result or some of opertion.Combining these advantages with the ability to pass parameters into these database objects makes
the SQL Server User-Defined function a very powerful tool.

20)

File 2




what is interface?
how we can use interface in .net?

what is partial class?
what is the difference between partial class and abstract class?

what is constructor?




what is difference between function and SP?
User-defined function
=====================

A user-defined function is a routine that encapsulates useful
logic for use in other queries. While views are limited to a
single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.

1>Procedure can return zero or n values whereas function can return one value which is mandatory.

2>Procedures can have input,output parameters for it whereas functions can have only input parameters.

3>Procedure allow select as well as DML statement in it whereas function allow only select statement in it.

4>Functions can be called from procedure whereas procedures cannot be called from function.

5>Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

6>We can go for transaction management in procedure whereas we can't go in function.

7>Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.





what is sclar and static function in sql server 2005?

why we set 'SET NOCOUNT ON and OFF'?
Ans : SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

why we set SET ANSI_NULLS ON and OFF?

why we SET QUOTED_IDENTIFIER ON ?

what is the difference between SP and Trigger?

if we have 1000 rows in table and no primary key or anything, how we will get 99 th row from the table?

what is WCF and WPF?

what is silverlight?

how do you handle xml pharasing in .net code or sql server?



what is temp table and what is the difference between temp table and local table?
Ans :A local temporary table lives until the connection is valid or until the duration of a compound statement.

They are created using same syntax as CREATE TABLE except table name is preceded by ‘#’ sign. When table is preceded by single ‘#’ sign, it is defined as local temporary table and its scope is limited to session in which it is created.

Open one session in Query Analyzer or SSMS (Management Studio) and create a temporary table as shown below.

CREATE TABLE #TEMP
(
COL1 INT,
COL2 VARCHAR(30),
COL3 DATETIME DEFAULT GETDATE()
)
GO


A global temporary table is permanently present in the database. However, the rows of the table are present until the connection is existent. Once the connection is closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

Syntax difference between global and local temporary table is of an extra ‘#’ sign. Global temporary tables are preceded with two ‘#’ (##) sign. Following is the definition. In contrast of local temporary tables, global temporary tables are visible across entire instance.

CREATE TABLE ##TEMP_GLOBAL
(
COL1 INT,
COL2 VARCHAR(30),
COL3 DATETIME DEFAULT GETDATE()
)
GO




How many types of cache are there in .net?
Ans :Caching is a feature that stores data in local memory, allowing incoming requests to be served from memory directly.

ASP.NET provides the following types of caching that can be used to build highly responsive Web applications:

1.Output caching : which caches the dynamic response generated by a request.
2.Fragment caching : which caches portions of a response generated by a request.
3.Data caching : which allows developers to programmatically retain arbitrary data across requests.


Type of exception handling in .Net ?
Ans: There are three ways to handle exceptions/errors in ASP.NET:

try-catch block. This is also called Structured Exception Handling (SEH).
Error Events.
Custom Error Page.

try-catch Block
Enclose code that accesses files, databases, and so forth inside a try-catch block because access to those resources might be denied due to various reasons causing an exception. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised. Hence, use the finally block to complete the housekeeping jobs.

Using Error Events
There are three different error events in ASP.NET that can be used in conjunction with SEH so that all exceptions are handled and the user is presented with a user-friendly error message.

Page_Error: Occurs when an error occurs within the Web page. This event is in the Web form.
Global_Error: Occurs when an error occurs within the application. This event is in the Gloabl.asax file.
Application_Error: Occurs when an error occurs within the application. This event is in the Gloabl.asax file.
Methods in the Server object are used to handle the exception in the error events.

GetLastError: Gets the last exception that occurred on the server.
ClearError: Use this method to handle the exception and stop the error to trigger the subsequent error event or display the error to the user.


Using Custom Error Pages
Use custom error page to handle HTTP exceptions such as page not found, unauthorized access, and so forth. You can specify custom error pages in two places:

customErrors section of the web.config file. This setting specifies the application-wide error page to display for unhandled HTTP errors. HTTP errors are identified by the HTTP status code. Include the tag in the customErrors to display a status code-specific error page. Does not work with .htm or .html files. Set the mode attribute to "On" to view the error page locally.
errorPage attribute of the @Page directive of the Web form to display the error page for the error generated on the particular Web form.



what is IIS Metabase..

IIS metabase is the repository of the configuration values that are set in the Internet Information Server (IIS). The IIS metabase in an XML file. It may be controlled through program or manually too.

In order to edit IIS metabase entries, the user needs to have administrative rights on the system. To do this, in run window, type "inetmgr". Browse to "Local Computer" and right click it. Click on "Properties". Select the "Enable Direct Metabase Edit" check box.

Many times, due to the existence of multiple versions of .NET framework, some settings in the IIS metabase may get affected and cause your program not to run. For such scenarios, you may take a backup of the IIS metabase XML file and recover it. To create a portable backup, open run window and type "inetmgr". Next browse to "Local Computer" and go to "All Tasks". Next, click on Backup/Restore Configuration. Next, click on "Create Backup". In the textbox box for Configuration Backup name, type a name for your backup file. Also select the encrypt backup option and type a password. To finish the process, click "OK".

File 1




Abstraction

Abstraction is a process of identifying the relevant qualities and behvaiors an object should possess.

Lets take an example to understand abstraction. A Laptop consists of many things such as processor, motherboard, RAM, keyboard,
LCD screen, wireless antena, web camera, usb ports, battery, speakers etc. To use it, you don't need to know how internally LCD screens,
keyboard, web camera, battery, wireless antena, speakers works. You just need to know how to operate the laptop by switching it on.

complexity is managed by using abstraction

Encapsulation

Encapsulation is a method for protecting data from unwanted access or alteration by packaging it in an object
where it is only accessible through the object's interface. Encapsulation are often referred to as information hiding.

For example, the Laptop is an object that encapsulates many technologies/hardwares that might not be understood clearly by most people who use it.

Inheritance

inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined.

Inheritance should not be confused with (subtype) polymorphism, commonly called just polymorphism in object-oriented programming.

Inheritance is a relationship between implementations, whereas subtype polymorphism is relationship between types (interfaces in OOP)

Polymorphism

Polymorphism is briefly described as "one interface, many implementations

There are two types of polymorphism.
Compile time polymorphism - It is achieved by overloading functions and operators
Run time polymorphism - It is achieved by overriding virtual functions


--------------------------------------------------------------------------------------
ASP.NET 2 Special Folders

App_Data
App_Code
App_Browsers
App_GlobalResources(.resx)
App_LocalResources
App_Themes
Bin
App_WebReferences

--------------------------------------------------------------------------------------
Global.asax

Application_Start
Application_End
Application_Error
Session_Start
Session_End


--------------------------------------------------------------------------------------
Access Specifiers

In C# .net the access specifiers are:
1.private
2.Internal
3.protected
4.protected Internal
5.Public

1)Public: if we declare any member as public then it can be
accessed from anywhere.
ex: Class Myclass1
{
public int x;
public int y;
}
Class Myclass2
{
public static void main()
{
Myclass1 mc=new Myclass1();
//direct accessing public member
mc.x=10;
mc.y=15;
console.writeline(mc.x,mc.y);
}
}

2)Private: Private members are accessible only within the
body of the class or the struct in which they are declared.
ex:
class Employee
{
public string name = "Jeet";
double salary = 100.00; // private access by default
public double AccessSalary() {
return salary;
}
}

class MainClass
{
public static void Main()
{
Employee e = new Employee();

// Accessing the public field:
string n = e.name;

// Accessing the private field:
double s = e.AccessSalary();
}
}
double s = e.salary; //can not be accessed due to private
lavel....

3)Protected: A protected member is accessible from within
the class in which it is declared, and from within any class
derived from the class that declared this member.

ex:class A
{
protected int x = 123;
}

class B : A
{
void F()
{
A a = new A();
B b = new B();
a.x = 10; // Error
b.x = 10; // OK
}
}
//a.x =10 generates an error because A is not derived from B.

4)internal - the members can access from the same project,
but any class

5)protected internal --> dual scope( internal + protected ).



--------------------------------------------------------------------------------------
There are six type of join in SQL 2000

1) INNER JOIN
2) OUTER JOIN
3) CROSS JOIN
4) EQUI JOIN
5) NATURAL JOIN
6) SELF JOIN


1) INNER JOIN :- PRODUCESS THE RESULT SET OF MATCHING ROWS
ONLY FROM THE SPECIFIED TABLES.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME JOIN 2ND_TABLE_NAME
ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

2) OUTER JOIN :- DISPLAY ALL THE ROWS FROM THE FIRST TABLE
AND MATCHING ROWS FROM THE SECOND TABLE.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME OUTER JOIN
2ND_TABLE_NAME
ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

THERE ARE THREE TYPES OF OUTER JOIN:

A)LEFT OUTER JOIN.
B)RIGHT OUTER JOIN.
C)FULL OUTER JOIN

A)LFET OUTER JOIN :- DISPLAYS ALL THE ROWS FROM THE FIRST
TABLE AND MATCHING ROWS FROM THE
SECOND TABLE.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME LEFT OUTER JOIN
2ND_TABLE_NAME ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

A)RIGHT OUTER JOIN :- DISPLAYS ALL THE ROWS FROM THE
SECOND TABLE AND MATCHING ROWS FROM
THE FIRST TABLE.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME RIGHT OUTER JOIN
2ND_TABLE_NAME ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

A)FULL OUTER JOIN :- DISPLAYS ALL MATCHING AND NONMATCHING
ROWS OF BOTH THE TABLES.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME FULL OUTER JOIN
2ND_TABLE_NAME ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

3)CROSS JOIN :- IN THIS TYPE OF JOIN, EACH ROWS FROM THE
JOIN WITH EACH ROWS FROM THE SECOND TABLE
WITHOUT ANY CONDTION.
ALSO CALLED AS CARTESIAN PRODUCT.

EXAMPLE---

SELECT COLUMN_LIST FROM 1ST_TABLE_NAME CROSS JOIN
2ND_TABLE_NAME


4) EQUI JOIN :- DISPLAYS ALL THE MATHCING ROWS FROM JOINED
TABLE. AND ALSO DISPLAYS REDUNDANT VALUES.
IN THIS WE USE * SIGN TO JOIN THE TABLE.

EXAMPLE---

SELECT * FROM 1ST_TABLE_NAME JOIN 2ND_TABLE_NAME
ON
1ST_TABLE_NAME.MATCING_COLUMN=2ND_TABLE_NAME.MATCING_COLUMN

5)NATURAL JOIN :- DISPLAYS ALL THE MATHCING ROWS FROM
JOINED TABLE.IT RESTRICT
REDUNDANT VALUES.

6)SELF JOIN :- IN THIS TABLE JOIN WITH ITSELF WITH
DIFFERENT ALIAS NAME.

ASSUME DEPARTMENT IS A TABLE:

SELECT A.DEP_NAME,B.MANAGER_ID(COLUMN LIST) FROM DEPARTMENT
A JOIN
DEPARTMENT B
ON A.MANAGER_ID=B.MANAGER_ID



--------------------------------------------------------------------------------------
Validation in DotNet
1.RequiredFieldValidator
2.RangeValidator
3.regularexpressionvalidator
4.comparevalidator
5.customvalidator
6.validationsummary

--------------------------------------------------------------------------------------
lifecycle of asp.net cycle page

Page_Init -- Page Initialization

LoadViewState -- View State Loading

LoadPostData -- Postback data processing

Page_Load -- Page Loading

RaisePostDataChangedEvent -- PostBack Change Notification

RaisePostBackEvent -- PostBack Event Handling

Page_PreRender -- Page Pre Rendering Phase

SaveViewState -- View State Saving

Page_Render -- Page Rendering

Page_UnLoad -- Page Unloading



--------------------------------------------------------------------------------------
new feature in 3.5

ASP.NET AJAX
In ASP.NET 2.0, ASP.NET AJAX was used as an extension to it. You had to download the extensions and install it. However in ASP.NET 3.5, ASP.NET AJAX is integrated into the .NET Framework, thereby making the process of building cool user interfaces easier and intuitive.

New Controls
ListView
DataPager

LINQ
LINQ defines operators that allow you to code your query in a consistent manner over databases, objects and XML

You can have multiple versions of ASP.NET on the same machine.

New Assemblies
System.Core.dll - Includes the implementation for LINQ to Objects
System.Data.Linq.dll - Includes the implementation for LINQ to SQL
System.Xml.Linq.dll - Includes the implementation for LINQ to XML
System.Data.DataSetExtensions.dll - Includes the implementation for LINQ to DataSet
System.Web.Extensions.dll:

--------------------------------------------------------------------------------------
What is hte difference between the Gridview,Datalist and Repeater
Features of a GridView
•Displays data as a table
•Control over
–Alternate item
–Header
–Footer
–Colors, font, borders, etc.
–Paging
•Updateable
•Item as row

Features of Repeater
•List format
•No default output
•More control
•More complexity
•Item as row
•Not updateable


Features of DataList
•Directional rendering
•Good for columns
•Item as cell
•Alternate item
•Updateable

There are Five Session State Modes :

InProc mode, which stores session state in memory on the Web server. This is the default.

StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

Custom mode, which enables you to specify a custom storage provider.

Off mode, which disables session state.


in asp.net following ways to maintain server site and
client site state.
client site:
1. View State
2. Query String
3. Hiddne Field
4. Cookies

Server Site is:
1. Session
2. Application



what is view state,session,cookies,caching, and diff between viewstate and session?

ViewState:

Viewstate is a hidden fields in an ASP.NET page, contains state of those controls on a page whose “EnableViewstate” property is “true”.

You can also explicitly add values in it, on an ASP.NET page like:Viewstate.Add( "Totfeatures", "50" );

Viewstate should be used when you want to save a value between different roundtrips of a single page as viewstate of a page is not accessible by another page.

Because Viewstate renders with the page, it consumes bandwith, so be careful to use it in applications to be run on low bandwith

Session :-

Session variables are usually the most commonly used.

When a user visits a site, it’s sessions starts and when the user become idle or leave the site, the session ends.
Session variables should be used to save and retrive user specefic information required on multiple pages.

Session variables consumes server memory, so if your may have a huge amount visiters, use session very carefully and instead of put large values in it try to put IDs and references

Cookies:-

Cookies are some values saved in browsers for a particular website o publicly accessible

The purpose of cookies is to help websites to identify visitors and retrieve their saved preferences
Cookies are also used to facilitate auto login by persisting user id in a cookie save in user’s browser
Because cookies have been saved at client side, they do not create performance issues but may create security issues as they can be hacked from browser.

Difference Between Viewstate & Session

Unlike Session state ViewState is a property of the web controls.

Both are used to persist certain data.

Values stored in the session are available across different pages in an application.

Where as the vdata contained in a control is persisted between page's post back by using that controls ViewState property.

View state cannot be used if the page donot post back to itself.

Solved : Cannot load the DLL xp_md5.dll


Monday, May 23, 2011

Issue : "Cannot load the DLL xp_md5.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.)."


Solution :

You are missing one dll to keep in this folder "D:\Program Files\Microsoft SQL Server\100\Tools\Binn\ "

You can download that file from here
http://download555.mediafire.com/3hw61lrj9njg/ki2omn4dzjm/xp_md5.dll.rar


Then keep this file in folder "D:\Program Files\Microsoft SQL Server\100\Tools\Binn\"

Then open your sql server and run this sql query so that you can register this dll in sql server.


xp_md5.dll

USE [master]
GO

EXEC dbo.sp_addextendedproc N'xp_md5', 'D:\Program Files\Microsoft SQL Server\100\Tools\Binn\xp_md5.dll'
 
GO


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com

How to add jQuery file in your web page ?


Tuesday, April 19, 2011

Hello Friends,

Take care during adding JQuery file in header of your page.

Check out this code before knowing the issue..


<html>
<head runat="server">
    <title>TenderContent Page</title>

    <script type="text/javascript" src="js/jquery-1.4.1.js"></script>

    <script type="text/javascript" src="js/jquery.validate.js"></script>

    <script type="text/javascript" src="js/jquery.alerts.js"></script>
</head>
<body>
    <div>
            Rajesh Singh
        </div>
</body>
</html>


You can see, i have added three jQuery files in above code,

Issue : If you feel you can add this file like below code

    <script type="text/javascript" src="js/jquery-1.4.1.js"/>

    <script type="text/javascript" src="js/jquery.validate.js"/>
    
    <script type="text/javascript" src="js/jquery.alerts.js"/>

Then you are wrong, if you will add like above then you will not get any error but you wont be able to preform jquery function what you wanted to do, jQuery will not work.

So please take care to add jquery during adding jquery file in your page.

Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


Trick to check your Regular expression


Thursday, March 10, 2011

Hello Friends,

Today i am going to explain you or provide you a trick by using which you can check your regular expression on page.

Let consider, we want to validate number input,
Like, you have "Mobile Number" field on your page, then it require only number input,

so here you will see, if you will enter Interger in text box, it will allow you to enter otherwise it will return error message.

So lets start here,

click on Start button at left botton of your destop screen, type notepad in run and open one notepad page.

Paste below code and select filetype as "all" and save as html page.

and then click on that page and open HTML page.

<html>
    <head>
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
     <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
         
     <script type="text/javascript">
            function rajesh(){
             alert(validate(document.getElementById("txtemailid").value));
             }
     
             function validate(text){
            return /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(text);
             }
        </script>

    </head>
    <body>
    <input type="text" id="txtemailid" name="txtemailid"/>
        <input type="button" value="check" onclick="return rajesh();"/>
    </body>
</html>




so you will see one text box, in which if you enter some text, it will return false, which means you cannot enter text in that field,



so now if you will enter number in that textbox then you will see it will return true, which means you can enter number in that field.




Explaination of code.
Step 1. Add this two files in head part of your page.

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>

Step 2. Add this script in head part of your page.

    <script type="text/javascript">
            function rajesh(){
             alert(validate(document.getElementById("txtemailid").value));
             }
     
             function validate(text){
            return /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(text);
             }
        </script>

in function rajesh(), you can see, i am calling another function named validate().

In validate function, you can see, i have kept your regular expression and passing value with name "text".

which will validate value "text" with regular expression and return true or false to you.

Step 3. In body part you can add UI part, which will have one textbox and submit button.

I am done now, so you can check this out at your end or if you have any issue or problem, please comment me, i will send you reply as soon possible.

or you can use this link to check our live code, http://jsfiddle.net/DhBrV/ or you can visit http://www.induway.com. to know more...


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com

getYear Date function of javascript gives alert as 111


Monday, February 7, 2011

Hello friends,

You might have encountered this issue many times while using datetimepicker on your modules.

For example, Datetimepicker is provideing you some other format of date and you want to display in some other format

or you want to add date, month or year to original date.

For example, if you are making alert of current date like below code then for date and month, you will get correct data
but for year you will wrong data.

so this you will be doing like this

var today =new Date();
alert(today);
alert(today.getMonth());
alert(today.getYear());

For today alert you will get
Mon Feb 07 2011 11:52:21 GMT+0530 (India Standard Time)

For today.getMonth() alert, you will get,
02

For today.getYear() alert you will get,
111

which is wrong, that should alert 2011,

This is because getYear method returns the year minus 1900,


Solution to this,

Instead of getYear, Please use getFullYear javascript function,
this is give you current year as 2011

This issue mostly has been seen in Mozila browser.


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


Validate Datetime with current Datetime using jQuery


Thursday, January 27, 2011

Suppose you want to validate both Date i.e with time and without time with current date and time,
that is, selected data should be greater that current date.

with time
27/01/2011 13:01

without time
27/01/2011

Below is the fuction, you can make use of it and you can check that selected date and time is greater or lesser than current date and time.

This function will return true and false,

if selected date is less than current date and time, then it will return false, else it will return true.




function CompareToForToday(value,params)
            {
               if(value!='')
        {
                    var mdy = value.split('/')     //Date and month split
                    var mdyhr= mdy[2].split(' ');  //Year and time split
                   
                    
                    if(mdyhr[1] == undefined){
                        var valuedate= new Date(mdyhr[0], mdy[1]-1, mdy[0]);
                    }
            else
                    {
                        var mdyhrtime=mdyhr[1].split(':');
                        var valuedate= new Date(mdyhr[0], mdy[1]-1, mdy[0], mdyhrtime[0], mdyhrtime[1]);
                    }

                    var d = new Date();
                    if(mdyhr[1] == undefined){
                        var todaydate = new Date(d.getFullYear(), d.getMonth(), d.getDate());
                    }
                    else
                    {
                        var mdyhrtime=mdyhr[1].split(':');
                        var todaydate = new Date(d.getFullYear(), d.getMonth(), d.getDate(),d.getHours(),d.getMinutes());
                    }

                    return Date.parse(valuedate) > Date.parse(todaydate);
                }
                else
                {
                    return true;
                }
            }



Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com