I am trying to submit an asp.net form inside a download mod. for some reason, all fields are returned empty (if I try this with fields outside the modal, it works fine). I saw some posts about this, but not the solutions solved my problem.
Thank you for your help on this. THANKS IN EXTENDED!
<div class="modal fade" id="myModalForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">EDIT ADVERTISMENT</h4>
</div>
<div class="modal-body">
<form id="updateadform" method="post" action="#" class="basic-form" >
<label for="title">Ad Name</label>
<asp:TextBox ID="modaltbadname" runat="server" placeholder="Ad Name"></asp:TextBox>
<label for="title">Promotional Text</label>
<asp:TextBox id="modaltbtbpromotional" TextMode="multiline" Rows="3" runat="server" />
<label for="description">Page</label>
<asp:DropDownList ID="modalddpage" placeholder="Insert the page the ad refers to" runat="server"></asp:DropDownList>
<label for="finish-date">Start Date</label>
<asp:TextBox ID="modaltbstartdate" runat="server" placeholder="20/01/2014" CssClass="datepicker" onchange="Page_ClientValidate();"></asp:TextBox>
<label for="finish-date">End Date</label>
<asp:TextBox ID="modaltbenddate" runat="server" placeholder="20/01/2014" CssClass="datepicker" onchange="Page_ClientValidate();"></asp:TextBox>
<asp:CompareValidator id="CompareValidator1" runat="server" ControlToCompare="modaltbstartdate" cultureinvariantvalues="true" display="Dynamic" enableclientscript="true" ControlToValidate="modaltbenddate" ErrorMessage="Start date must be earlier than finish date" type="Date" setfocusonerror="true" Operator="GreaterThanEqual" text="Start date must be earlier than finish date"></asp:CompareValidator>
<div class="right-side">
</div>
<div class="clearfix"></div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<asp:Button type="button" ID="savead" CssClass="btn btn-primary" runat="server" Text="Save Changes" OnClick="savead_Click" OnClientClick="savevariables()" UseSubmitBehavior="false" />
</div>
</div>
</div>
</div>
Code behind:
protected void savead_Click(object sender, EventArgs e)
{
string x = idtoupdate.Value;
string y = modaltbadname.Text;
DB.UpdateAd(modaltbadname.Text, modaltbtbpromotional.Text, modalddpage.SelectedValue, modaltbstartdate.Text, modaltbenddate.Text, int.Parse(idtoupdate.Value));
}
source
share