Thursday, 27 June 2013

get checkbox checked value in MVC3

View:
@Html.CheckBox("Make it as subfolder", false, new { onchange = "addSubFolder();", id = "chkSubFolder" })

Jquery:
function addSubFolder() {
    debugger;
    var val = $("#chkSubFolder").is(":checked") ? true : false;
    $('#dialogBox').focus();
    if (val == true) {
        $('#drpSubFolder').show();
        //alert('selected');
    }
    else if (val == false) {
        $('#drpSubFolder').hide();
        //alert('un checked');       
    }
}

Clear Text box value throw Jquery in MVC3

Jquery:
$('#closesubfolder').live("click", function (event)
 {
         $('input[type=text]').val('');
});

View;
<img src="Source" alt="Close" height="25px" width="20px"
                        id="closesubfolder" />

Clear dropdown value using jquery in MVC3

JQUERY :
$('#closesubfolder').live("click", function (event) {
        $('select').val('0');
    });

In View :
<img src="location" alt="Close" height="25px" width="20px"
                        id="closesubfolder" />

linq difference between any and all [SOLVED]

All() :
All is used to detemine if all elements satisfy a condition.
Any() :
Any tells you whether there are any elements in the sequence at all.

Ex:
var numbers = new[]{2,4,6,8,9,10,12};
var all = numbers.All(n => n % 2 == 0); // returns false - not all numbers are even
var any = numbers.Any(); // returns true - there sequence contains at least one element

Sunday, 12 May 2013

Difference between Stored Procedure and Function

Difference between Stored Procedure and Function


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 allows select as well as DML(INSERT/UPDATE/DELETE) statements in it whereas function allows 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 cannot be utilized in a select statement whereas function can be embedded in a select statement.

Differences between stored procedures and triggers

Differences between storedprocedures and triggers 

1. When you create a trigger you have to identify event and action of your trigger but when you create s.p you don't identify event and action 

2.Trigger is run automatically if the event is occured but s.p don't run automatically but you have to run it manually 

3. Within a trigger you can call specific s.p but within a sp you cannot call atrigger 

4.Trigger execute implicitly whereas store procedure execute via procedure call from another block. 

5.We can call a stored procedure from front end (.asp files, .aspx files, .ascx files etc.) but we can't call a trigger from these files. 

6. Stored procedure can take the input parameters, but we can't pass the parameters as an input to a trigger. 

What are different types of caching in ASP.Net? Caching in asp.net


There are three main types of Caching:
  1. Page Output caching : Caching complete page
  2. Fragment caching: Caching a portion of a page
  3. Data Caching: Caching data