thanks,
-Daniel
3 Answers, 1 is accepted
This is not a bug - radprompt accept the name of the callback function only, not the function itself and you cannot pass arguments like that.
Would you please provide more details about your exact setup and what you want to achieve?
Best wishes,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I created a Imagebutton control (for editing a text comment field) that is built as a class and can be added to a gridTemplateColumn with bindable properties. This button calls radPrompt by taking the values of the properties and assembling them into a radPrompt call command that fires on the "onClick" event of the button. I was hoping to get the data back out of the prompt by using the event args passed to the javascript, but if this fires on load, then the data has not been changed at that point.
help?
here's the class for the button:
Imports
System.Web.UI.WebControls
Imports
System.Web.UI
Imports
System.ComponentModel
Public
Class CommentButton
Inherits ImageButton
Private _comment As String
Private _radTitle As String
Private _radText As String
Private _callbackFunction As String
Public Sub New()
MyBase.New()
MyBase.ImageUrl = "../images/commentoff.gif"
End Sub
Public Sub New(ByVal comment As String)
MyBase.New()
MyBase.ImageUrl = "../images/commenton.gif"
_comment = comment
End Sub
'The underlying property is a string, and returns a string.. so why they felt the need to put an error on this????
<System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")> _
Public Shadows ReadOnly Property ImageUrl() As String
Get
Return MyBase.ImageUrl
End Get
End Property
Public Shadows Property AlternateText() As String
Get
Return MyBase.AlternateText
End Get
Set(ByVal value As String)
MyBase.AlternateText = value
End Set
End Property
Public Property Comment() As String
Get
Return _comment
End Get
Set(ByVal value As String)
_comment = value
If Not _comment = Nothing And _comment <> "" Then
MyBase.ImageUrl = "../images/commenton.gif"
End If
End Set
End Property
Public Property PromptTitle() As String
Get
Return _radTitle
End Get
Set(ByVal value As String)
_radTitle = value
End Set
End Property
Public Property PromptText() As String
Get
Return _radText
End Get
Set(ByVal value As String)
_radText = value
End Set
End Property
Public Property CallbackFunctionString() As String
Get
Return _callbackFunction
End Get
Set(ByVal value As String)
_callbackFunction = value
End Set
End Property
Protected Overrides Sub AddAttributesToRender(ByVal writer As System.Web.UI.HtmlTextWriter)
' radprompt(Text, callBackFn, oWidth, oHeight, callerObj, oTitle, defaultValue)
writer.AddAttribute(
"Comment", _comment)
writer.AddAttribute(
"OnClick", "radprompt('" & _radTitle & "', testme(this), 500, 150,null, '" & _radText & "', '" & _comment & "'); return false;")
MyBase.AddAttributesToRender(writer)
End Sub
End
Class
In your scenario, I suggest to set only the name of the function in the OnClick eventhandler along with the arguments that you wish to pass to that function.
Here is how to read the arguments in the callbackFn:
function promptDialog(text,title,defvaule,btn) |
{ |
function callbackFn() |
{ |
//this way you can have direct access to the arguments of the promptDialog() function |
} |
radprompt(text,callbackFn,500,150,null,title,defvalue); |
} |
Greetings,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.