Click here to Skip to main content
15,921,463 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i given the code but im not getting value for textbox

What I have tried:

Public Function checkStatus() As Boolean

       Dim Hour As System.Web.UI.WebControls.TextBox
       Dim txtStatus As DropDownList
       Dim bResult As Boolean = False
       For i As Integer = 0 To TaskGrid.Rows.Count - 1
           Hour = DirectCast(TaskGrid.Rows(i).Cells(0).FindControl("hour"), TextBox)
           txtStatus = DirectCast(TaskGrid.Rows(i).Cells(0).FindControl("txtstatus"), DropDownList)
           Dim t As String = Hour.Text

           If txtStatus.SelectedItem.Text = "" Or
               hour.Text = "" Then
               bResult = True
           End If
       Return bResult
   End Function
Updated 8-Apr-17 4:17am

1 solution

Hour = DirectCast(TaskGrid.Rows(i).FindControl("hour"), TextBox)
txtStatus = DirectCast(TaskGrid.Rows(i).FindControl("txtstatus"), DropDownList)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900