Hi,
I am trying to add dynamic rows to a table from user's input into two different popup windows. Is it possible to do so?
So far I was able to add row from a single popup but don't know if I can insert rows into the same table from a different popup.
Someone please guide me.
I have markup like this:
<div><asp:DropDownList ID="DropDownList1" runat="server"><asp:ListItem Value="1">panel1</asp:ListItem><asp:ListItem Value="2">panel1</asp:ListItem><asp:ListItem Value="3">panel2</asp:ListItem></asp:DropDownList><asp:Button ID="Button3" runat="server" Text="Add" OnClick="Button3_Click" /><asp:Button ID="Button1" runat="server" Text="Button" /><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1" PopupControlID="Panel1" BackgroundCssClass="modalBackground" CancelControlID="btnCancel"></ajaxToolkit:ModalPopupExtender><asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" Style="display: none" Width="800px" Height="230px"><label class="popupLabel">
Type: </label><asp:TextBox BorderStyle="inset" BorderWidth="2px" BorderColor="Black" ID="txtType" runat="server"></asp:TextBox><button type="button" id="updateButton" onclick="return updatePerson();">Ok</button><asp:Button ID="btnCancel" runat="server" Text="Cancel" /></asp:Panel><asp:Button ID="Button2" runat="server" Text="Button" /><ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="Button2" PopupControlID="Panel2" BackgroundCssClass="modalBackground" CancelControlID="btnCancel1"></ajaxToolkit:ModalPopupExtender><asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" align="center" Style="display: none" Width="1000px" Height="340px"><label class="popupLabel">
Date: </label><asp:TextBox BorderStyle="inset" BorderWidth="2px" BorderColor="Black" ID="TextBox1" runat="server"></asp:TextBox><div style="clear: both; margin: auto;"><asp:Button ID="Button4" runat="server" Text="Ok" OnClientClick="return addRecord();" UseSubmitBehavior="False" CausesValidation="false" /><asp:Button ID="btnCancel1" runat="server" Text="Cancel" /></div></asp:Panel></div><div id="tableData" style="display:none"><table id="peopleTable" class="table table-bordered
table-condensed table-striped"><thead><tr><th>Date</th><th>Type</th></tr></thead></table></div>And Jquery to add rows to the table 'peopleTable'
<script type="text/javascript">
function updatePerson() {
document.getElementById('tableData').style.display = "block";
addPersonToTable();$find("ModalPopupExtender1").hide();
return false;
}
function addPersonToTable() {
// First check if a <tbody> tag exists, add one if not
if ($("#peopleTable tbody").length == 0) {$("#peopleTable").append("<tbody></tbody>");
}
// Append row to the table$("#peopleTable tbody").append("<tr>" + "<td>" + $("#txtDate").val() + "</td>" +"<td>" + $("#txtType").val() + "</td>" +"</tr>");
}</script>How do I incorporate another popup data into the same table? Please guide me through this.
Thanks.