Okay okay this is killing me. I have a gridview with a footerrow to add rooms to the selected value of bldg. When there are no rooms I dropped a detailsview in the emptydatatempla te. I wanted to use the same code I have so the user doesn't have to deal with bldgid but nothing is working. Any ideas how I can accomplish this task, maybe I need to redo everything. Footer row says this and works
If I do this in the emptydatatempla te it doesn't find dvAddRoom. If I take it out and put it under the gridview it finds it but....it still won't let me just take the selected value it says bldgid can't be null
Code:
Protected Sub gridLocations_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) If e.CommandName = "Insert" AndAlso Page.IsValid Then ' Insert new record Dim roomnum As String = CType(gridLocations.FooterRow.FindControl("txtAddRoom"), TextBox).Text Dim bldgid As Integer TextBox).Text AddNewRoom(roomnum, bldgid) End If
Code:
Protected Sub dvAddRoom_ItemCommand(ByVal sender As Object, ByVal e As DetailsViewCommandEventArgs) If e.CommandName = "Insert" AndAlso Page.IsValid Then ' Insert new record Dim roomnum As String = CType(dvAddRoom.FindControl("NewRoom"), TextBox).Text Dim bldgid As Integer bldgid = gridBldgLoc.SelectedValue AddNewRoom(roomnum, bldgid) End If End Sub