Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I want to do the validation in the gridview footertemplet.In the footertemplt i have a insert hyperlink button ,textbox,s and ddl .so how to i can validate each one of the field in the gridview .Any one kindly assist me


Thanks
Posted

 
Share this answer
 
Comments
gokul.net 3-Mar-12 5:25am    
Both the links are in server error.Kindly send another link
thatraja 3-Mar-12 8:50am    
Both links working for me. Try different browser or clear temp files & try again.
thatraja 3-Mar-12 8:50am    
5!
Abhinav S 3-Mar-12 8:55am    
Thank you.
JavaScript
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#lkPaymentMethod").click(function () {

function requiredfiled() {
                var UpdatePaymentMethod = $('#txtPaymentMethod').val();
                var paymentmethod = $('#txtInsertPaymentMethod').val();
                   if (paymentmethod == "") {
                       $('#label1').html("Please Fill Payment Method");
                       return false;
                }

<asp:GridView ID="grdPaymentMethod" runat="server" AutoGenerateColumns="False" OnRowCancelingEdit="grdPaymentMethod_RowCancelingEdit"
                OnRowCommand="grdPaymentMethod_RowCommand" OnRowEditing="grdPaymentMethod_RowEditing"
                ShowFooter="True" OnRowDeleting="grdPaymentMethod_RowDeleting" OnRowUpdating="grdPaymentMethod_RowUpdating">
                <Columns>
                    <asp:TemplateField HeaderText="ID">
                        <EditItemTemplate>
                            <asp:Label ID="lbEditPaymentMethodID" runat="server" Text='<%# Eval("UserPaymentMethodID") %>'></asp:Label>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lbPaymentMethodId" runat="server" Text='<%# Eval("UserPaymentMethodID") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Payment Method">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtPaymentMethod" ClientIDMode="Static"  runat="server" Text='<%# Eval("PaymentMethod") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtInsertPaymentMethod" ClientIDMode="Static" runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lbPaymentMethod" runat="server" Text='<%# Eval("PaymentMethod") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:LinkButton ID="btnUpdate" runat="server" OnClientClick="javascript:return requiredfiled();" CommandName="Update">Update</asp:LinkButton>
                            <asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:Button ID="btnSave" runat="server" OnClientClick="javascript:return requiredfiled();" CommandName="Save" Text="Submit" />
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="lkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>


I m also working on it...it will help you..any query u can ask from me
 
Share this answer
 
v2
Comments
André Kraak 3-Mar-12 5:22am    
Edited solution:
Added pre tags
thatraja 3-Mar-12 5:26am    
You're doing great job. Well done.
André Kraak 3-Mar-12 8:42am    
Thanks.
nawabprince 3-Mar-12 5:25am    
i didnt understand wht u waana say..??
thatraja 3-Mar-12 5:26am    
He formatted your code. Always put your code in code-block

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900