Hello all,
I have a gridview where i have 4 textboxs to enter value.
I have a check box for each row,
Now i need to make sure the textbox are not empty for the selected
check box row only.
Below i wrote the code but not working can please
help me get right code.
Thanks
<script type="text/javascript" >
$(function () {
$(document).on('click', '#btnAddPlate', function () {
//$("#btnReserveTest").click(function () {
var flad = 0;
var Parenttr = $('input[type="checkbox"]:checked');
Parenttr.each(function () {
alert("1");
if ($(this).parent().parent().find(".txtp").val() == '') {
alert("2");
flad += 1;
};
});
if (flad > 0) {
alert("Select Sales Man");
return false;
} else {
alert("SuccessAll");
return true;
}
});
});
</script>
<asp:GridView ID="gvPlate" runat="server" Font-Names="Times New Roman"
Font-Size="Small" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkHeader" runat="server" Checked="true" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkRow" runat="server" Checked="true" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Resrv_Id" HeaderText="Resrv Id" />
<asp:BoundField DataField="Vin" HeaderText="Vin" />
<asp:BoundField DataField="ResDate" HeaderText="Resrv Date" />
<asp:BoundField DataField="Model Code" HeaderText="Model Code" />
<asp:BoundField DataField="Model Year" HeaderText="Model Year" />
<asp:BoundField DataField="Model No_" HeaderText="Model No" />
<asp:BoundField DataField="Color" HeaderText="Color" />
<asp:BoundField DataField="Location" HeaderText="Location" />
<asp:BoundField DataField="Status" HeaderText="Status" />
<asp:BoundField DataField="Plate" HeaderText="Plate" />
<asp:BoundField DataField="Stock_Type" HeaderText="Stock Type" />
<asp:TemplateField HeaderText="Plate" >
<ItemTemplate>
<asp:TextBox ID="txtEnterPlate" runat="server" Text='<%# Eval("Plate") %>' Width="75" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cust Name" >
<ItemTemplate>
<asp:TextBox ID="txtCustomerName" runat="server" Text='<%# Eval("Customer_Name") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Contact No" >
<ItemTemplate>
<asp:TextBox ID="txtCustMobile" runat="server" Text='<%# Eval("CustMobileNo") %>' MaxLength="8" Width="80" CssClass="tmob" />
<asp:RegularExpressionValidator ID="MobileValidator"
runat="server" ControlToValidate="txtCustMobile"
ErrorMessage="Should be no" ForeColor="Red"
ValidationExpression="^[0-9]+$" Font-Size="Smaller"></asp:RegularExpressionValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Civil Id" >
<ItemTemplate>
<asp:TextBox ID="txtCivilId" runat="server" Text='<%# Eval("CustCivilId") %>' MaxLength="12" Width="110" />
<asp:RegularExpressionValidator ID="CivilIdValidator"
runat="server" ControlToValidate="txtCivilId"
ErrorMessage="Should be no" ForeColor="Red"
ValidationExpression="^[0-9]+$" Font-Size="Smaller"></asp:RegularExpressionValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Deposit" >
<ItemTemplate>
<asp:TextBox ID="txtDeposit" runat="server" Text='<%# Eval("CustDeposit") %>' MaxLength="12" Width="100" />
<asp:RegularExpressionValidator ID="DepositValidator"
runat="server" ControlToValidate="txtDeposit"
ErrorMessage="Should be no" ForeColor="Red"
ValidationExpression="^[0-9 .]+$" Font-Size="Smaller"></asp:RegularExpressionValidator>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>