Hi
I am adding RadDesktopAlerts programmable using the following code a button is added along with a handler when the button is clicked I would like to process the event and then close the alert! Is this possible?
Regards
Joe
Dim Popup As New RadDesktopAlert
Popup.AlertImage = Me.ImageList1.Images(3)
Popup.AlertImage.Tag = 1
Popup.CaptionText = PopData.Rows(i).Item("msgTitle").ToString
Popup.ContentText = PopData.Rows(i).Item("msgBody").ToString
Dim bt As New RadButtonElement
bt.Text = "Dismiss " & PopData.Rows(i).Item("ID").ToString
bt.Tag = PopData.Rows(i).Item("ID").ToString
AddHandler bt.Click, AddressOf SetPop
Popup.ButtonItems.Add(bt)
Popup.Show()
5 Answers, 1 is accepted
Thanks for writing and for your question.
Yes, you can use the Hide method of the RadDesktopAlert component in your event handler to hide the desktop alert upon clicking on the button.
this.radDesktopAlert1.Hide();
Do not hesitate to write back anytime you have further questions or need assistance.
Sincerely yours,
Deyan
the Telerik team
I cannot seem to get Hide() to work. I create the DesktopAlert in runtime, set AutoClose to false and Hide() it when needed.
I have also tried to set the AutoClose to true and AutoCloseDelay = 1 in runtime to get it to close, but no luck.
Anyone else with this problem?
- jorge
Please try the following example, everything is working as expected here, with Telerik Controls version Q2 2010 SP2:
Imports
Telerik.WinControls.UI
Public
Class
Form1
Dim
Popup
As
New
RadDesktopAlert
Dim
WithEvents
ButtonOpen
As
New
RadButton
Dim
WithEvents
ButtonClose
As
New
RadButton
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
ButtonOpen.Dock = DockStyle.Bottom
ButtonOpen.Text =
"Open"
ButtonClose.Dock = DockStyle.Bottom
ButtonClose.Text =
"Close"
Me
.Controls.Add(ButtonOpen)
Me
.Controls.Add(ButtonClose)
End
Sub
Private
Sub
ButtonOpen_Click(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
ButtonOpen.Click
Popup.CaptionText =
"Caption"
Popup.ContentText =
"Content"
If
(Popup.ButtonItems.Count = 0)
Then
Dim
bt
As
New
RadButtonElement
bt.Text =
"Dismiss"
AddHandler
bt.Click,
AddressOf
SetPop
Popup.ButtonItems.Add(bt)
End
If
Popup.Show()
End
Sub
Private
Sub
ButtonClose_Click(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
ButtonClose.Click
Popup.Hide()
End
Sub
Private
Sub
SetPop(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Popup.Hide()
End
Sub
End
Class
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Can any one help please.
I want to show multiple DesktopAlert, and when the user click on the button (inside the Desktop Alert), i want to hide it.
Here is my code:
For i = 0 To 5
Dim s As New RadButtonElement("click me " & i)
s.Tag = i
Dim desk As New RadDesktopAlert()
desk.CaptionText = "New E-mail Notification"
desk.ContentText = "testing " & i
desk.AutoClose = False
AddHandler s.Click, AddressOf AAA
desk.ButtonItems.Add(s)
m_Alerts.Add(desk)
desk.Show()
Next
Private Sub AAA(sender As System.Object, e As System.EventArgs)
Dim txt As RadButtonElement = CType(sender, RadButtonElement)
MessageBox.Show(txt.Tag) ' here to display the id of the button
'
how to hide the DesktopAlert . . .. .
End Sub
Thanks
Thank you for writing.
Here is the modified version of your code that will help you achieve the desired functionality :
Dim
dic
As
New
Dictionary(Of RadButtonElement, RadDesktopAlert)()
Private
Sub
AAA(sender
As
System.
Object
, e
As
System.EventArgs)
Dim
txt
As
RadButtonElement =
CType
(sender, RadButtonElement)
dic(txt).Hide()
MessageBox.Show(txt.Tag)
' here to display the id of the button
End
Sub
Private
Sub
RadButton1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
RadButton1.Click
For
i = 0
To
5
Dim
s
As
New
RadButtonElement(
"click me "
& i)
s.Tag = i
Dim
desk
As
New
RadDesktopAlert()
desk.CaptionText =
"New E-mail Notification"
desk.ContentText =
"testing "
& i
desk.AutoClose =
False
AddHandler
s.Click,
AddressOf
AAA
desk.ButtonItems.Add(s)
dic.Add(s, desk)
desk.Show()
Next
End
Sub
Should you have any other questions, I will be glad to assist you.
Regards,
Anton
the Telerik team