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