blogspot visit counter

Friday 3 May 2013

Javascript validation for Gridview footer textbox

Basic Step by Step WCF WebService[-2]
Introdouction : -

In my Article I am explain how  in can use java script for  validate text box in footer row and check text box in now then generate  the alert please insert Record using  ASp.Net 

Description : -

In My previous Post I have Explain how i can use WCF  . In this article i am explain how  i can validate textbox within grid view and generate the java script validation.

javascript validation function as shown below if you are not use the site  maste page then write this code within <head> tag other wise write this code in
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

Your javascript code is here

</asp:Content>

javascript validation function as shown below

With in site master page



<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

<script type="text/javascript">
    function ValidateGridview() {
        titlename = document.getElementById('<%=((TextBox)grd_party_influenc.FooterRow.FindControl("txt_f_title")).ClientID%>');
        if (titlename.value ==0) {
            alert("Please Insert The Title ....");
            titlename.focus();
            return false;
        }
       // return true;
    }
  
</script></asp:Content>

Use this JavaScript validation within <head> tag

<head>

<script type="text/javascript">
    function ValidateGridview() {
        titlename = document.getElementById('<%=((TextBox)grd_party_influenc.FooterRow.FindControl("txt_f_title")).ClientID%>');
        if (titlename.value ==0) {
            alert("Please Insert The Title ....");
            titlename.focus();
            return false;
        }
       // return true;
    }
  
</script>

</heaad>


Use Java Script Validation Function as shown Below 

  <FooterTemplate>
                        <asp:LinkButton ID="lnk_btn_insert" runat="server" CommandName="Insert" OnClientClick="ValidateGridview()">Insert</asp:LinkButton>
                    </FooterTemplate>

 

Image As Shown Below



Asp.net Interview Question And Answer

2 comments:

  1. This is very nice post. Thank sir please provide more article related to grid view

    ReplyDelete
  2. Thank u.. good post.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...