vendredi 18 mars 2016

How to select checkbox depend on amount received in textbox in asp.net c#

This My HTML Code.

<script type="text/javascript">  
// for check all checkbox  
        function CheckAll(Checkbox) {  
            var GridVwHeaderCheckbox = document.getElementById("<%=grdReceiptSells.ClientID %>");  
            for (i = 1; i < GridVwHeaderCheckbox.rows.length; i++) {  
                GridVwHeaderCheckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;  
            }  
        }  
    </script>

    <script>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div style="overflow:auto; width:100%; margin-left:0px; margin-top:0px; ">
        <table align="center" class="HKtable">
                <tr class="HKtr">
                    <th class="HKth" colspan="8">
                        <asp:Label ID="lblSearch" runat="server" Text="Search" Font-Bold="True" Font-Size="Medium" ForeColor="White"></asp:Label>
                    </th>
                </tr>
                <tr class="HKtr">
                    <td></td>
                    <td style="width:108px;" class="HKtd">
                        <asp:Label ID="lblInvoiceDateFrom" runat="server" Text="From"></asp:Label>
                    </td>
                    <td style="width:108px;" class="HKtd">
                        <asp:Label ID="lblInvoiceDateTo" runat="server" Text="To"></asp:Label>
                    </td>
                    <td colspan="5" class="HKtd">

                    </td>
                </tr>
                <tr class="HKtr">
                    <td style="width:80px;" class="HKtd">
                        <asp:Label ID="lblInvoiceDateSearch" runat="server" Text="Invoice Date"></asp:Label>
                    </td>
                    <td style="width:108px;" class="HKtd">
                        <asp:TextBox ID="txtInvoiceDateFrom" runat="server" Width="100px"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="CalendarExtenderInvoiceDateFrom" TargetControlID="txtInvoiceDateFrom" Format="dd/MM/yyyy" runat="server" />
                    </td>
                    <td style="width:108px;" class="HKtd">
                        <asp:TextBox ID="txtInvoiceDateTo" runat="server" Width="100px"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="CalendarExtenderInvoiceDateTo" TargetControlID="txtInvoiceDateTo" Format="dd/MM/yyyy" runat="server" />
                    </td>
                    <td class="HKtd">
                        <asp:Label ID="lblTypeSearch" runat="server" Text="Type"></asp:Label>
                    </td>
                    <td class="HKtd">
                        <asp:DropDownList ID="ddlTypeSearch" runat="server" Width="206px">
                            <asp:ListItem>All Types</asp:ListItem>
                            <asp:ListItem>Normal</asp:ListItem>
                            <asp:ListItem>Extra</asp:ListItem>
                            <asp:ListItem>Rough</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td style="width:40px;" class="HKtd">
                        <asp:Label ID="lblTermsSearch" runat="server" Text="Terms"></asp:Label>
                    </td>
                    <td style="width:130px;" colspan="2" class="HKtd">
                        <asp:TextBox ID="txtTermsSearch" runat="server" Width="120px"></asp:TextBox>
                    </td> 

                </tr>
                <tr class="HKtr">
                    <td style="width:80px;" class="HKtd">
                        <asp:Label ID="lblPartyNameSearch" runat="server" Text="Party Name"></asp:Label>
                    </td>
                    <td colspan="2" style="width:216px;" class="HKtd">
                        <asp:DropDownList ID="ddlPartyNameSearch" runat="server" Width="226px" Height="21px"></asp:DropDownList>
                    </td>
                    <td style="width:40px;" class="HKtd">
                        <asp:Label ID="lblCarats" runat="server" Text="Carats"></asp:Label>
                    </td>
                    <td style="width:205px;" class="HKtd">
                        <asp:TextBox ID="txtCaratsSearch" runat="server" Width="200px"></asp:TextBox>
                    </td>
                     <td style="width:66px;" class="HKtd">
                        <asp:Label ID="lblInvoiceNoSearch" runat="server" Text="Invoice No."></asp:Label>
                    </td>
                    <td class="HKtd">
                        <asp:TextBox ID="txtInvoiceNoSearch" runat="server" Width="120px" Height="15px"></asp:TextBox>
                    </td>
                    <td style="width:66px;" class="HKtd">
                        <asp:Button ID="btnSearchSells" runat="server" Text="Search" OnClick="btnSearchSells_Click" />
                    </td>

                </tr>
        </table>
        </div>


    <br />
    &nbsp;<br />
    <div style="overflow:auto; width:100%; margin-left:0px; margin-top:0px; ">
        <table align="center" class="HKtable">
            <tr>
                <td>
                    <asp:Label ID="lblPaymentReceived" runat="server" Text="Payment Received"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPaymentReceived" onkeypress="filterDigits(event)" Width="100px" runat="server"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    <br />
    <br />
    <div style="overflow:auto; width:100%; margin-left:0px; " align="center">
        <asp:GridView ID="grdReceiptSells" runat="server" AutoGenerateColumns="False" CellPadding="13" ForeColor="#333333" GridLines="None" AllowPaging="True" AllowSorting="True" ShowFooter="True" DataKeyNames="Invone,Type" OnRowDataBound="grdReceiptSells_RowDataBound" OnPageIndexChanging="grdReceiptSells_PageIndexChanging" >
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:TemplateField>  
                        <HeaderTemplate>   
                            <asp:CheckBox ID="chkAllSelect" runat="server" onclick="CheckAll(this);" />  
                        </HeaderTemplate>  
                        <ItemTemplate>  
                            <asp:CheckBox ID="chkSelect" runat="server" />  
                        </ItemTemplate>  
                    </asp:TemplateField> 
                    <asp:BoundField HeaderText="Invoice No" DataField="Invone" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Invoice Date" DataField="InvDate" DataFormatString="{0:dd/MMM/yyyy}" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Type" DataField="Type" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Terms" DataField="Terms" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Due Date" DataField="DueDate" DataFormatString="{0:dd/MMM/yyyy}" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Pieces" DataField="SumPieces" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Carats" DataField="SumCarats" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="GrossAmt" DataField="SumGrossAmt" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Discounted Amount 1" DataField="SumDisAmt1" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Discounted Amount 2" DataField="SumDisAmt2" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Final Amount" DataField="SumFinalAmt" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Party" DataField="Party" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Person" DataField="Person" ItemStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Sales Executive" DataField="SalesExe" ItemStyle-HorizontalAlign="Center">                  
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:BoundField>


            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="1" />
            <PagerSettings PageButtonCount="20" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" BorderStyle="Solid" BorderWidth="1" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:Label ID="lblGridSelectID" runat="server" Visible="False"></asp:Label>
        <asp:Button ID="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" />
        </div>

How to block other checkboxes When Payment Received amount gets 0? how to get checkbox order as we select like 5th then 3rd then 6th, only this checked box invoice no. should be inserted.

This is Image of My front End. I have shown With red Arrow




Aucun commentaire:

Enregistrer un commentaire