Hi,
I am getting am getting the error "unterminated string constant" when I try to call a rad alert from code behind. I know the problem is that the message that is being sent to the radalert contains invalid characters but I am not sure how to fix it.
I am calling the radalert on a grid's ItemUpdated event and am putting the e.exception.message in the string that I pass to the radalert and apparanetly it has invalid characters. Since I can't control what the characters are in the e.exception.message, is there a way to send this information to a radalert so that it will accept the e.exception.message.
The e.exception message is
Incorrect syntax near ','.
Unclosed quotation mark after the character string ".
Below is the code I am using to call the radalert.
Thank You
Tracy
.
I am getting am getting the error "unterminated string constant" when I try to call a rad alert from code behind. I know the problem is that the message that is being sent to the radalert contains invalid characters but I am not sure how to fix it.
I am calling the radalert on a grid's ItemUpdated event and am putting the e.exception.message in the string that I pass to the radalert and apparanetly it has invalid characters. Since I can't control what the characters are in the e.exception.message, is there a way to send this information to a radalert so that it will accept the e.exception.message.
The e.exception message is
Incorrect syntax near ','.
Unclosed quotation mark after the character string ".
Below is the code I am using to call the radalert.
Protected
Sub
rgvSecurityUsers_ItemUpdated(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridUpdatedEventArgs)
Handles
rgvSecurityUsers.ItemUpdated
If
Not
e.Exception
Is
Nothing
Then
Dim
EditItem
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
strUserId
As
String
= EditItem.GetDataKeyValue(
"UserID"
).ToString()
Dim
strUserName
As
String
= TryCast(EditItem(
"UserName"
).Controls(0), TextBox).Text
Dim
strMessage
As
String
=
"User "
+ strUserId +
" "
& strUserName &
" cannot be updated. Reason: "
+ e.Exception.Message
MsgBox(e.Exception.Message)
Dim
scriptstring
As
String
=
"radalert('"
+ strMessage +
"', 330, 210);"
e.KeepInEditMode =
True
e.ExceptionHandled =
True
ScriptManager.RegisterStartupScript(
Me
,
Me
.[
GetType
](),
"radalert"
, scriptstring,
True
)
End
If
End
Sub
Thank You
Tracy
.