Fetch Text Box Data inside Rad Grid at client side

2 posts, 0 answers
  1. Sunny
    Sunny avatar
    26 posts
    Member since:
    Feb 2013

    Posted 08 Apr 2013 Link to this post

    Hello Sir /Madam,

    Currently i am using rad grid in my project now i am using asp text box control inside the item template of rad grid now i Have to check all Textboxes text at client side and apply Validation on it if all text boxes text is empty then validation message should be shown. here is my screen shot that i have attached named (TextBox_inside_grid) in this screen shot if i dont write any text in any text box than at button click message Should be display and if i click on cancel button than all validation messages show be hide and if any text is inside the textboxes it should also be clear. Currently i am writing this code:

     function Materialreceived_ClientClick1() {
                    var count = 0;
                    var grid = $find("<%=RadGrid_POPUP_MaterialReceived.ClientID %>");
                    var MasterTable = grid.get_masterTableView();
                    for (var i = 0; i < MasterTable.get_dataItems().length; i++) {
                        var gridItemElement = MasterTable.get_dataItems()[i].findElement("txt_receivedqty");
                         var lenght = ((gridItemElement).val());
                        if (lenght>0) {

                   if (count == 0) {
                        alert("Please check atleast one !");
                        document.getElementById("<%=lblgrid.ClientID %>").innerHTML = 'User must enter a number on at least one row.';
                        return false;

    But its not working. so please tell me asap.

    thanks in advance
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Apr 2013 Link to this post


    One suggestion is you can use the RequiredFieldValidator with validationgroup which will validate the TextBox control inside the ItemTemplate. You can include the TextBox and the submit button under the same validation group and set the Cancel Button's CausesValidation property to false.

Back to Top