This is a migrated thread and some comments may be shown as answers.

Fetch Text Box Data inside Rad Grid at client side

1 Answer 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 08 Apr 2013, 12:31 PM
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) {

                     
                        count++;
                        break;
                    }
                }
               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

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Apr 2013, 01:14 PM
Hi,

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.

Thanks,
Princy.
Tags
Grid
Asked by
Sunny
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or