I have a RadGrid which has several columns visible:
Name, Date Added, Comment
When they go into Edit Mode, I dont want Name to be in the form as I need to capture the users logon ID from the HTTPContext and automatically store this in the underlying table rather then the name.
In other words:
In the COMMENTS table I am storing the USER_ID.
In the recordset coming back, I am joining COMMENTS to USERS table to present the Name in the RadGrid.
When they go into Edit Mode....I dont want Name to be editable, because I actually want to capture the users logon ID and pass this in.
I am using an ObjectDataSource and my Insert is failing because a method with a signature which includes a "NAME" parameter cant be found:
In My ObjectDataSource
Public Sub AddComment( _
ByVal DASHBOARD_PAGE_ID As Long, _
ByVal LOGON_ID As String, _
ByVal DATE_ADDED As String, _
ByVal COMMENTARY As String, _
ByVal LIVE As Boolean, _
ByVal PROMOTED As Boolean, _
ByVal RESPONSIBLE_PERSON As String, _
ByVal OUTCOME As String)
' Create Connection
Dim con As New SqlConnection(_conString)
'Create Command
Dim cmdText As String = "SP_CLIN_DASHBOARD_ADD_COMMENT" ' This requires a parameter of DashboardPage_ID
Dim cmd As New SqlCommand(cmdText, con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue(
"@DASHBOARD_PAGE_ID", DASHBOARD_PAGE_ID)
cmd.Parameters.AddWithValue(
"@LOGON_ID", LOGON_ID)
cmd.Parameters.AddWithValue(
"@DATE_ADDED", DATE_ADDED)
cmd.Parameters.AddWithValue(
"@COMMENTARY", COMMENTARY)
cmd.Parameters.AddWithValue(
"@LIVE", LIVE)
cmd.Parameters.AddWithValue(
"@PROMOTED", PROMOTED)
cmd.Parameters.AddWithValue(
"@RESPONSIBLE_PERSON", RESPONSIBLE_PERSON)
cmd.Parameters.AddWithValue(
"@OUTCOME", OUTCOME)
cmd.ExecuteNonQuery()
End Sub
Where I am capturing the LOGON_ID and passing it in:
Protected Sub srcComments_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles srcComments.Inserting
e.InputParameters.Item(
"DASHBOARD_PAGE_ID") = Session("DASHBOARD_PAGE_ID")
e.InputParameters.Item(
"LOGON_ID") = HttpContext.Current.User
e.InputParameters.Item(
"DATE_ADDED") = Now()
End Sub
Thanks