==========Date Picker in Jquery==========
<input id="TB_DueDate" type="text" class="form-control" readonly="true" /><script>
$("#TB_DueDate").datepicker({
beforeShow: function () {
$(".ui-datepicker").css('font-size', 14);
},
dateFormat: 'dd-M-yy',
changeMonth: true, changeYear: true
});
</script>
$("#BreakAmount").show();
$("#AddFeeDetail").hide();
$("#TB_ClassNameFeeDetail").prop('disabled', false);
$("#TB_InstFeeDetail").val('0');
var name = $("#TB_InstFeeDetail").val();
====================ajax=Call=Web Service===========
$.ajax({
url: 'http://localhost:000000/...../Master.asmx/GetDetail',
method: 'get',
dataType: 'json',
data: { id:id, name:name},
success:function (result) {
alert("Success : " + FeeAdd[0].result);
$(result).each(function (index, item) {
if (result[0].result == 1) {
alert("Successfully Added Detail ");
}
else
alert("Not Added Successfully Detail");
});
}, //Success
error: function (ex) {
alert("Error :AddFeeDetail : " + ex)
}
}); //----ajax method end
=============Web Service===============================
using System.Web.Script.Serialization;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
[WebMethod(EnableSession = true)]
public void GetDetail(string id,string name)
{
JavaScriptSerializer js = new JavaScriptSerializer();
string sql = "select * From tblDetail";
DataTable dt = new DataTable();
string cs = ConfigurationManager.ConnectionStrings["Mycon"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
}
List<FeeHead> liHead = new List<FeeHead>();
foreach (DataRow row in dt.Rows)
{
FeeHead obj = new FeeHead();
obj.id = row["id"].ToString();
obj.name = row["name"].ToString();
liHead.Add(obj);
}
Context.Response.Write(js.Serialize(liFeeHead));
}//Session Condition Closed
No comments:
Post a Comment