This is a migrated thread and some comments may be shown as answers.
__doPostBack function
4 Answers 120 Views
This is a migrated thread and some comments may be shown as answers.
Cemka
Top achievements
Rank 1
Cemka asked on 25 Feb 2011, 12:40 PM
Hello,
I have an ASP.NET Ajax Calendar, with AutoPostBack = false
When client change viewed month I use this event : ClientEvents-OnCalendarViewChanged="postBack"
To call this Javascript function :
           
function postBack(sender, args) {
__doPostBack("<%= RadCalendar1.UniqueID %>", "myArgument");
}


Here is my Page_Load function :

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadCalendar1.SelectedDate = DateTime.Today;
            }
            else
            {
                string eventTarget = (this.Request["__EVENTTARGET"] == null ? string.Empty : this.Request["__EVENTTARGET"]);
                string eventArgument = (this.Request["__EVENTARGUMENT"] == null ? string.Empty : this.Request["__EVENTARGUMENT"]);
                if (eventArgument.Equals("myArgument"))
                {
                    RadCalendar1.SelectedDate = DateTime.Today.AddDays(-10);
 // Just for test
                }
            }
 
            FillHolidayDataset(RadCalendar1.SelectedDate);
        }


The problem is when I change month, I Have this error :

Invalid navigation argument: [myArgument]

[ApplicationException: Invalid navigation argument: [myArgument]]
   Telerik.Web.UI.RadCalendar.RaisePostBackEvent(String eventArgument) +864
   Telerik.Web.UI.RadCalendar.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


What's wrong with my doPostBack function ?

Regards
Cemka

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 25 Feb 2011, 01:42 PM
Hello Cemka,

You can invoke the ajaxRequest from the function instead of __doPostBack.
aspx:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
</telerik:RadAjaxManager>

javascript:
function postBack(sender, args)
{
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest("myArgument");//Making ajax request with the argument
}

Thanks,
Shinu.
0
Cemka
Top achievements
Rank 1
answered on 25 Feb 2011, 02:10 PM
Thank you for your answer.

What is RadAjaxManager1_AjaxRequest ?
(because I have an error with your code ...)

Regards
Cemka
0
Accepted
Daniel
Telerik team
answered on 25 Feb 2011, 03:29 PM
Hello Cemka,

Please test the attached demo to see how to implement the aforementioned code.

Regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Cemka
Top achievements
Rank 1
answered on 25 Feb 2011, 09:21 PM
Thank you very much.

Regards
Cemka
Asked by
Cemka
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Cemka
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or