How to display radiobutton ID into database

windows

Guest
i have problem displaying radiobutton ID into the database...can u please help mi... i have some code for u to see

' this is my class db module which has the function of creating record
Public Class DBModule
Public Function createRecord(ByVal pobjModule As Modules) As Integer
Dim intNumofRowaffected As Integer
objCmd.CommandText = "INSERT INTO tblModule" & _
"(strNameMO,strAbbreviationMO,strCodeMO,intCoordinatorIdMO)" & _
" VALUES ('" & pobjModule.ModuleName & "', '" & pobjModule.ModuleAbbreviation & "','" & pobjModule.ModuleCode & "', '" & pobjModule.CoordinatorId & "')"
objCn.Open()
intNumofRowaffected = objCmd.ExecuteNonQuery
objCn.Close()
Return intNumofRowaffected
End Function
end class



' this is the codes i used to create record and store in my database
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
btnSelect.Visible = False
End Sub
'this code is.. when i pressed saved, it will save the record of the modules
Private Sub btnSave2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave2.Click, btnBack1.Click
Dim objModule As New Modules
Dim objDBModule As New DBModule
Dim intNumOfRecord As Integer
objModule.ModuleName = txtModuleName.Text.Trim
objModule.ModuleCode = txtModuleCode.Text.Trim
objModule.moduleAbbreviation = txtAbbreviation.Text.Trim
' he error is at the line below..but is just that i cannot able to solve it..
objModule.CoordinatorId=grdLecturer.SelectedItem.ID
intNumOfRecord = objDBModule.createRecord(objModule)
lblMessage.Text = "Saved " & intNumOfRecord & " record."
End Sub

' this code is...when i pressed this button. it will display the records of lecturer on the datagrid
Private Sub btnModuleCoordinator_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModuleCoordinator.Click
Dim objDblecturer As New DBLecturer
Dim objArrayList As New ArrayList

objArrayList = objDblecturer.getLecturerRecords
grdLecturer.DataSource = objArrayList
grdLecturer.DataBind()


grdLecturer.Visible = True
btnSelect.Visible = True


End Sub
' this button is used when i select the lecturer and it will display on the textbox
Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
Dim strName As String
strName = Request.Form("radLecturer")
txtCoordinator.Text = strName
grdLecturer.Visible = False

End Sub
this is the datagrid, containing the radiobutton and displaying all the records
Private Sub grdLecturer_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdLecturer.ItemDataBound
If e.Item.ItemType <> Web.UI.WebControls.ListItemType.Header And _
e.Item.ItemType <> Web.UI.WebControls.ListItemType.Footer Then
e.Item.Cells(1).Text = "<input type=""Radio"" value=""" & _
e.Item.Cells(2).Text & """name=""radLecturer"" & id=""LecturerId"">"
'e.Item.Cells(0).Text > ""

End If
End Sub
End ClassWhat is the error message?objModule.CoordinatorId=grdLecturer.SelectedItem.ID

This sentence over here is unable to execute.The error show input string is not defined or suitable
 
Back
Top