Martin Roussel
Top achievements
Rank 1
Martin Roussel
asked on 05 Nov 2012, 01:57 PM
Hi, im using a RadNotification in a user control (ascx). The control is loaded dynamically on the page either in a placeholder or in a RadTabStrip (both methods are experiencing the issue). It seems I cant define any property of the RadNotification in code-behind except at Page Loading/Init (I try to set the Title, Text and ContentIcon based on some conditions before calling .Show() ). I also tried fixing the user control on the page (not dynamically loaded) and still same issue.
I try the same on another page where RadNotification is fixed on the page (not in user control) and then it works good.
Any idea?
TIA
I try the same on another page where RadNotification is fixed on the page (not in user control) and then it works good.
Any idea?
TIA
8 Answers, 1 is accepted
0
Hello Martin,
It seems like you have some AJAX functionality and the button/control that initiates the AJAX request does not update the notification control. If this is the case then you are experiencing the expected behavior of the MS AJAX framework. You would need to include the notification in the partial postback in order to change its properties. Also, when creating a control dynamically you need to make sure you re-create it with every postback and with the same ID.
All the best,
Marin Bratanov
the Telerik team
It seems like you have some AJAX functionality and the button/control that initiates the AJAX request does not update the notification control. If this is the case then you are experiencing the expected behavior of the MS AJAX framework. You would need to include the notification in the partial postback in order to change its properties. Also, when creating a control dynamically you need to make sure you re-create it with every postback and with the same ID.
All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin Roussel
Top achievements
Rank 1
answered on 06 Nov 2012, 03:39 PM
Thanks Marin,
the following solved the problem
the following solved the problem
protected void Page_Load(object sender, EventArgs e)
{
manager = RadAjaxManager.GetCurrent(Page);
manager.AjaxSettings.AddAjaxSetting(manager, RadNotification1);
manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);
}
0
Andy Green
Top achievements
Rank 2
answered on 16 Nov 2012, 08:10 AM
Hi Martin
I have the same issue, but your solution doesn't work. I get an error on the manager.AjaxRequest +=....
Says its an event and cannot be called directly.
Any ideas?
Andy
I have the same issue, but your solution doesn't work. I get an error on the manager.AjaxRequest +=....
Says its an event and cannot be called directly.
Any ideas?
Andy
0
Martin Roussel
Top achievements
Rank 1
answered on 16 Nov 2012, 12:22 PM
Andy,
Personally, ive never encounter such error. Probably the admin will know better. What I can tell you is make sure tha
In my case, my user control is using a RadAjaxManagerProxy and the parent page contains the RadAjaxManager. Post your code here since its probably what they will ask you.
Martin
Personally, ive never encounter such error. Probably the admin will know better. What I can tell you is make sure tha
t "
RadAjaxManager_AjaxRequest
" is defined:protected
void
RadAjaxManager_AjaxRequest(
object
sender, AjaxRequestEventArgs e)
{
....
}
In my case, my user control is using a RadAjaxManagerProxy and the parent page contains the RadAjaxManager. Post your code here since its probably what they will ask you.
Martin
0
Andy Green
Top achievements
Rank 2
answered on 16 Nov 2012, 02:52 PM
Thanks Martin
When the Mods pick this up here is my code.
I have a radAjaxManager on the parent page. If I have the notification on the parent page with the function in that pages code behind, it works OK.
This is the control
This is the Notification - still in dev at the moment so some params will change.
This is the cod hehind for the control
Its the manager.ajaxsettings that commentout that errors.
This is a simple function to set the message - will be eplaced with a DB function.
And as suggested I have this empty function
Andy
When the Mods pick this up here is my code.
I have a radAjaxManager on the parent page. If I have the notification on the parent page with the function in that pages code behind, it works OK.
This is the control
<
asp:ScriptManagerProxy
ID
=
"ScriptManagerProxy"
runat
=
"server"
></
asp:ScriptManagerProxy
>
<
telerik:RadNotification
ID
=
"rnNotification"
runat
=
"server"
Height
=
"100px"
Width
=
"300px"
VisibleOnPageLoad
=
"True"
EnableEmbeddedSkins
=
"false"
Skin
=
"Activity"
></
telerik:RadNotification
>
This is the Notification - still in dev at the moment so some params will change.
This is the cod hehind for the control
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim manager = RadAjaxManager.GetCurrent(Page)
manager.AjaxSettings.AddAjaxSetting(manager, rnNotification)
'manager.AjaxRequest += New RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest)
'config the notifier
rnNotification.TitleIcon = ""
rnNotification.Title = ""
rnNotification.ContentIcon = "../App_Themes/Images/Info_32.png"
End Sub
Its the manager.ajaxsettings that commentout that errors.
This is a simple function to set the message - will be eplaced with a DB function.
Public Sub GetNotifications(Location_ID As Int32)
rnNotification.Show("New person here! " + Location_ID)
End Sub
And as suggested I have this empty function
Protected Sub RadAjaxManager_AjaxRequest(sender As Object, e As AjaxRequestEventArgs)
End Sub
Andy
0
Hello Andy,
It is not always necessary to add the AjaxRequest handler dynamically, so you can simply remove this last line and set the handler in the markup if you find it more suitable. You can access the controls in the code-behind through the FindControl method.
What is important is that you include the RadNotification in the list of updated controls when you want to change its settings. More details on dynamic creation of AJAX settings is available here:
http://www.telerik.com/help/aspnet-ajax/ajax-add-ajaxsettings-programmatically.html
You can also declare AJAX settings in the markup if your notificartion is in the same INaming container as the ajax manager (I cannot confirm this with just a few snippets, so I am just throwing in an idea).
Nevertheless, back to the main issue - it seems you are using VB, so you should adapt the C# syntax (http://msdn.microsoft.com/en-us/library/t3d01ft1(v=vs.100).aspx):
I am also attaching here a simple sample I built on top of your snippets.
Kind regards,
Marin Bratanov
the Telerik team
It is not always necessary to add the AjaxRequest handler dynamically, so you can simply remove this last line and set the handler in the markup if you find it more suitable. You can access the controls in the code-behind through the FindControl method.
What is important is that you include the RadNotification in the list of updated controls when you want to change its settings. More details on dynamic creation of AJAX settings is available here:
http://www.telerik.com/help/aspnet-ajax/ajax-add-ajaxsettings-programmatically.html
You can also declare AJAX settings in the markup if your notificartion is in the same INaming container as the ajax manager (I cannot confirm this with just a few snippets, so I am just throwing in an idea).
Nevertheless, back to the main issue - it seems you are using VB, so you should adapt the C# syntax (http://msdn.microsoft.com/en-us/library/t3d01ft1(v=vs.100).aspx):
AddHandler
manager.AjaxRequest,
AddressOf
RadAjaxManager_AjaxRequest
I am also attaching here a simple sample I built on top of your snippets.
Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andy Green
Top achievements
Rank 2
answered on 19 Nov 2012, 12:49 PM
Thanks Marin
I'll try this and let you know.
Yes my project is VB, but the code is what came out of your code converter.
Andy
I'll try this and let you know.
Yes my project is VB, but the code is what came out of your code converter.
Andy
0
Hi Andy,
I hope things will work out well for you. As for the code converter - this is still automated software and like all such converters may not be 100% accurate. Adding a handler dynamically is a general programming task, so the developer should be able to overcome such issues, as information on the matter is freely available in the net.
All the best,
Marin Bratanov
the Telerik team
I hope things will work out well for you. As for the code converter - this is still automated software and like all such converters may not be 100% accurate. Adding a handler dynamically is a general programming task, so the developer should be able to overcome such issues, as information on the matter is freely available in the net.
All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.