locked
Grid view row validation -VB.NET RRS feed

  • Question

  • User-1578974752 posted

    I have grid view ,in which few cell are being validated using formulas.

     For Each item As GridViewRow In kgrid.Rows
                If item.RowType = DataControlRowType.DataRow Then
                    Dim label As Label = CType(item.FindControl("Label1"), Label)
                    Dim box As TextBox = CType(item.FindControl("TextBox1"), TextBox)
        If box.Text > 0 Then
                        If boxa.Text = "" Or boxb.Text = "" Then
                            stdreq.Text = " Qty is required"

                        Else
                            stdreq.Text = ""

    My issue is ,there might be 10 rows in the grid view,if one line or last row only with condition    If box.Text > 0 Then,then working fine ,but if first row shows  " Qty is required" message,then next row will execute the else statement.I want it to be:
    if any of the 10 lines have  stdreq.Text = " Qty is required". it must stay until the last row validated. and if all rows executed with out  stdreq.Text = " Qty is required" then I want to place kgrid.databind() How to be done. Thanks

    Tuesday, January 15, 2019 5:27 AM

All replies