c# - how to get values of dynamic textbox in Asp.net using Json Ajax -
jsfiddle -> https://jsfiddle.net/rdgkr4t6/
i have count date diff , according create dynamic textbox , update dynamic textbox value table , in date should have auto increment todate , process on single person ..
how send data aspx.cs file , how update in data base accordin date todate diff ...
$(document).ready(function () { $('#btnsave').on("click", function (e) { e.preventdefault(); }) }) function getvalue() { alert('hi'); var fromdate = $('#<%=txtfromdate.clientid%>').val(); var todate = $('#<%=txttodate.clientid%>').val(); var total = $('#<%= txttotal.clientid %>').val(); var dataobj = { "fromdate": fromdate, "todate": todate, }; var datafinal = []; // dataobj.dyval = []; if (total >0) { (var = 1; <= total; i++) { datafinal.push($("#txtday1" + i).val()); alert(datafinal); //dataobj.dyval.push($("#txtday1" + i).val()); //alert(dataobj); } } var para = { "odhours": datafinal }; alert(json.stringify(para)); alert(json.stringify(dataobj)); $.ajax({ type: "post", url: "od.aspx/putdataindb", async: false, data: json.stringify({ "param": dataobj, "odhours": datafinal }), contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { console.log(data); alert("hi"); }, error: function (req, status, err) { console.log('something went wrong', status, err); } }); } function tot() { //alert("fun tot call"); var mydate = $('#<%=txtfromdate.clientid %>').val(); var chunks = mydate.split('/'); var formatteddate = [chunks[1], chunks[0], chunks[2]].join("/"); var mydate1 = $('#<%=txttodate.clientid %>').val(); var chunks1 = mydate1.split('/'); var formatteddate1 = [chunks1[1], chunks1[0], chunks1[2]].join("/"); dt1 = new date(formatteddate); dt2 = new date(formatteddate1); //alert(dt1); //alert(dt2); var total = 1 + (math.floor((date.utc(dt2.getfullyear(), dt2.getmonth(), dt2.getdate()) - date.utc(dt1.getfullyear(), dt1.getmonth(), dt1.getdate())) / (1000 * 60 * 60 * 24))); //alert(total); $('#<%= txttotal.clientid %>').val(total); $('#appenddays').html(""); (var = 1; <= total; i++) { $('#appenddays').append('<tr><td valign="top" align="left"><label>day ' + + '(hours)</label></td><td valign="top" align="left"> </td><td class="control-group" valign="top" align="left"><div> <input type="text" id="txtday1' + + '" style="width: 235px;" /></div></td></tr>'); } } </script>
thank in advance new asp.net c# ready code--> dynamic textbox ajax call not working --> value; pass data aspx.cs file ..
Comments
Post a Comment