-
March 24th, 2011, 09:06 AM
#1
Page Method question
Dear experts,
I have a javascript function that is called on tab change of a tab container. From that javascript function, I call a simple page method. But though the page method does everything correctly, a failure is reported.
Here is my code:
function JSSetMarketingActiveTabIndexSession(sender, args) {
if (sender != null) {
PageMethods.SetSessionVariable("MarketingActiveTabIndex", sender.get_activeTabIndex(), OnSucceeded, OnFailed);
}
}
[System.Web.Services.WebMethod]
public static void SetSessionVariable(string sessionVariableName, object value)
{
HttpContext.Current.Session[sessionVariableName] = value;
}
When I place breakpoints in the page method and in the OnFailed function, the execution stops in both of them almost at the same time, so an exception is caught even before the page method has done anything.
Could you please help me on this?
Thanks.
-
March 28th, 2011, 08:11 AM
#2
Re: Page Method question
When I place breakpoints in the page method and in the OnFailed function
Well i dont see either of these two posted in your short code snip ...
BTW.. Please use code tags .. [code] your code here [/code]
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
March 28th, 2011, 08:40 AM
#3
Re: Page Method question
Originally Posted by GremlinSA
Well i dont see either of these two posted in your short code snip
My page method is this:
Code:
[System.Web.Services.WebMethod]
public static void SetSessionVariable(string sessionVariableName, object value)
{
HttpContext.Current.Session[sessionVariableName] = value;
}
On Failed():
Code:
function OnFailed(exception) {
if (exception != null) {
var tabInformation = $get('<%# Page.Form.FindControl("tcInformation").ClientID %>').control;
tabInformation.set_activeTabIndex(2);
lblExceptionDetails = document.getElementById('<%# lblExceptionDetails.ClientID %>');
if (lblExceptionDetails != null) {
lblExceptionDetails.innerHTML = exception._message;
return false;
}
}
}
-
March 29th, 2011, 04:12 AM
#4
Re: Page Method question
I've looked over the code and done a few test's and cant find anything wrong.. I'm guessing that you have other code that is run either at 'pageload' or a controls 'onload' event that is failing...
check all the controls if they have an onload event and what code is running there...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
March 31st, 2011, 10:59 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|