Here I have a popup window with one text area and 2 dropdown index. In popup window user needs to enter data. Then this data has to be stored in given path.
jQuery
$("#saveasfile").click(function () {
var customer = {};
customer.name = $("[id*=comment]").val();
customer.scramble = $("[id*=DropDownList2]").val();
customer.confirm = $("[id*=DropDownList1]").val();
$.ajax({
type: "POST",
url: "D:\Scramble.txt",//path
data: JSON.stringify(customer),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
$('#myModal').dialog("close");//modal popup window
// alert("Record inserted successfully.");
}
});
});
</script>
Table design for modal popup:
<textarea class="form-control" id="comment"></textarea>
</td>
<td>
<div class="dropdown">
<asp:DropDownList ID="DropDownList2" runat="server" CssClass="selectpicker">
<asp:ListItem Text="Alpha-Numeric Scramble" />
<asp:ListItem Text="Packed-Decimal Scramble" />
<asp:ListItem Text="Date-Time Scrambler" />
</asp:DropDownList>
</div>
<div class="dropdown">
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectpicker">
<asp:ListItem Text="Yes" />
<asp:ListItem Text="No" />
</asp:DropDownList>
And having a button with "savefile" id.
Here is the Button code:
<button runat="server" id="Saveasfile" class="btn btn-primary" OnClick="saveasfile()">Save </button>
By clicking the "Save" button the user should save the data which is entered in the table rows.
While clicking the "Save" button it is closing automatically. While debugging it is showing like "No element found".
What should I do?