I would like to replace js windows by bootstrap popover in few pages but I have two issues and I don't find any solutions.
First, if I click on the button to display the popover, required fields are fired directly. Even if I fill in it the message "xx is a required field" stay displayed.
Second, when I try to save my data. Every fields contain an extra character ",". So if I put 10 in the price field in code behind the value of my field is "10,"
Thanks for your help :)
My code:
<asp:Button ID="btnAdd" runat="server" Text="add" CssClass="btn btn-info"data-toggle="popover" data-placement="top" title="add something" ValidationGroup="vgAdd" />
<div id="testBox" class="hide">
<asp:ValidationSummary ID="vsTest" runat="server" ValidationGroup="vgAdd" DisplayMode="BulletList" ShowMessageBox="false" ShowSummary="false" />
<div class="row">
<div class="form-group col-sm-6">
<asp:Label ID="lblPrice" runat="server" Text="price" AssociatedControlID="txtPrice" CssClass="control-label"></asp:Label>
<div class="input-group">
<span class="input-group-addon">$</span>
<asp:TextBox ID="txtPrice" runat="server" CssClass="form-control" MaxLength="12"></asp:TextBox>
</div>
<asp:CompareValidator ID="cvPrice1" runat="server" Display="None" ValidationGroup="vgAdd" ControlToValidate="txtPrice"
ErrorMessage="price is invalid." ValueToCompare="0" Type="Double" Operator="GreaterThan"></asp:CompareValidator>
<asp:CompareValidator ID="cvPrice" runat="server" Display="None" ValidationGroup="vgAdd" ControlToValidate="txtPrice"
Type="Double" Operator="DataTypeCheck" ErrorMessage="price is invalid."></asp:CompareValidator>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ValidationGroup="vgAdd" ControlToValidate="txtPrice"
ErrorMessage="Default price is a required field." SetFocusOnError="True" Display="Dynamic" />
</div>
<div class="form-group col-sm-6">
<asp:Label ID="lblDesc" runat="server" Text="Description" AssociatedControlID="txtDesc" CssClass="control-label"></asp:Label>
<asp:TextBox ID="txtDesc" runat="server" CssClass="form-control" TextMode="MultiLine" MaxLength="255"></asp:TextBox>
</div>
</div>
<div class="clearfix">
<asp:Button ID="btnSave" runat="server" ValidationGroup="vgAdd" CausesValidation="true"
CssClass="btn btn-primary pull-right"
OnClick="btnSaveTest_Click" Text="Save" />
</div>
</div>
$("[data-toggle=popover]").popover({
html: true,
content: function () {
return $('#testBox').html();
}
});