To get value from text Box or Dropdown
$("#txtName").val();
$("#DropdownId").val()
To Set value : $("#txtName").val("Hi");
For Calling Dropdown change event:
$("#DropdownId").change(function(e)
{
//Your Code
}
);
For Button Click Event:
$(".btnSave").click(function ()
{
//Your Code
}
);
For Disable Button : $(".btnSave").attr('disabled', 'disabled');
For Enable Button from Disable Mode : $(".btnSave").removeAttr('disabled');
For Calling Serverside method:
Server Side Method:
[WebMethod]
public string GetResult(int Id = 0)
{
return result;
}
Client Side Calling:
function Getvalue(NewId)
{
var result = null;
var scriptUrl = "/Module/Page/GetResult?Id=" + NewId;
$.ajax({
url: scriptUrl,
type: 'get',
dataType: 'html',
async: false,
success: function(data) {
result = data;
}
});
}
Get Date and Time:
var currentDateTime = new Date();
var month = currentDateTime.getMonth() + 1
var day = currentDateTime.getDate()
var year = currentDateTime.getFullYear()
var hours = currentDateTime.getHours()
var minutes = currentDateTime.getMinutes()
var currentDate = day + "/" + month + "/" + year;
Get Query String Value:
function querystring(key)
{
var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
var r=[], m;
while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
return r;
}
calling : var Queryvalue =querystring('id');
To view the Json Object:
JSON.stringify(jsonobject);
To Merge another json object:
var jsonobject1=Yourobject1;
var jsonobject2=Yourobject2;
jsonobject1.push.apply(jsonobject1,jsonobject2);
$("#txtName").val();
$("#DropdownId").val()
To Set value : $("#txtName").val("Hi");
For Calling Dropdown change event:
$("#DropdownId").change(function(e)
{
//Your Code
}
);
For Button Click Event:
$(".btnSave").click(function ()
{
//Your Code
}
);
For Disable Button : $(".btnSave").attr('disabled', 'disabled');
For Enable Button from Disable Mode : $(".btnSave").removeAttr('disabled');
For Calling Serverside method:
Server Side Method:
[WebMethod]
public string GetResult(int Id = 0)
{
return result;
}
Client Side Calling:
function Getvalue(NewId)
{
var result = null;
var scriptUrl = "/Module/Page/GetResult?Id=" + NewId;
$.ajax({
url: scriptUrl,
type: 'get',
dataType: 'html',
async: false,
success: function(data) {
result = data;
}
});
}
Get Date and Time:
var currentDateTime = new Date();
var month = currentDateTime.getMonth() + 1
var day = currentDateTime.getDate()
var year = currentDateTime.getFullYear()
var hours = currentDateTime.getHours()
var minutes = currentDateTime.getMinutes()
var currentDate = day + "/" + month + "/" + year;
Get Query String Value:
function querystring(key)
{
var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
var r=[], m;
while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
return r;
}
calling : var Queryvalue =querystring('id');
To view the Json Object:
JSON.stringify(jsonobject);
To Merge another json object:
var jsonobject1=Yourobject1;
var jsonobject2=Yourobject2;
jsonobject1.push.apply(jsonobject1,jsonobject2);