I need to pass a value from GridView1 to my sql string so it can pull the information and color the calendar as needed. Here is my code, while this works and all values are given the results are not good. Every Calendar is the same. Each calendar on each row should have different information for the most part. I know the problem is for FOR EACH LOOP but I do not know any other way to get the ID needed. I have also tried:
Dim RPID As TextBox = DirectCast(GridView1.FindControl("RPID"), TextBox) DID NOT WORK!!!
Dim RPID As TextBox = CType(GridView1.FindControl("RPID"), TextBox) DID NOT WORK!!!
Here is the code that somewhat works but not as needed......
Protected Sub HideMonth(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
CheckIn = Session("V1")
CheckOut = Session("V2")
For Each GridViewRow As GridViewRow In GridView1.Rows
Dim ID As TextBox = CType(GridViewRow.FindControl("RPID"), TextBox)
Dim myconnection As New Data.SqlClient.SqlConnection("blah blah blah"", myconnection)
myda1 = New Data.SqlClient.SqlDataAdapter("blah blah blah", myconnection)
myda1.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@ID", Data.SqlDbType.Int, 1))
myda1.SelectCommand.Parameters("@ID").Value = ID.Text
View Complete Post