You must Sign In to post a response.
  • Category: ASP.NET

    How To Make The Field is Required in Gridview Footer Row Text box using javascript. KeyPress,KeyUp

    Hi Developers,

    How To Make The Field is Required in Gridview Footer Row Text box using javascript. (KeyPress,KeyUp)

    Am creating a Project with Gridview footer row Insert,Update,Delete Options.
    I almost done it. but some of the textboxes i can't able to validate using Required Field Validator.
    So now i want to validate that Gridview Footer TextBoxes with not comples Just message Box show (The field is required) . That's all.

    This Validation is Fire Witout a button click is as well.

    So Please help me to how i am done it.
    Reply Should be Within tomorrow Afternoon na will be better to me Friends.

    Thanks with
    Paul.S
  • #765313
    In footer template when you fire a button just check if the textboxes has values or not
    see below snippet

    <script>
    function Validate(txtNameId) {
    if (document.getElementById(txtNameId).value.length > 0)
    return true;
    alert('Name should not be empty');
    return false;
    }
    </script>
    <FooterTemplate>
    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
    <asp:Button ID="btnAdd" runat="server" Text="Add" OnClientClick="validate('<%# ((GridViewRow)Container).FindControl("textDateSent").ClientID %>')" />
    </FooterTemplate>

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765314
    Thanks Mr.Kulkarni .

    But i dont know how to implement your code .
    Because My textboxes are in inside the gridview footer Row.

    So tell me some idea to implement your code.

    Thanks with
    Paul.S


Sign In to post your comments