Showing posts with label postback. Show all posts
Showing posts with label postback. Show all posts

Wednesday, March 28, 2012

System.WebForms.PageRequestManagerParserErrorException The message revieved from the serve

I am trying to use update panel's feature to asyncronously postback and update the data in one of my grid. I am using Master Page and ASPX and a User Control that actually contains the button, Update Panels and a Grid.

When I click btnRefresh I get the following error:

System.WebForms.PageRequestManagerParserErrorException The message revieved from the server could not be parsed...

My ascx looks like this:

<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>

<asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="Conditional">
<ContentTemplate>
<asp:ImageButtonID="btnRefresh"runat="server"ImageUrl="~/refresh.gif"OnClick="ImageButton1_Click"/>
</ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanelID="UpdatePanel2"runat="server">
<Triggers>
<asp:AsyncPostBackTriggerControlID="btnRefresh"/>
</Triggers>
<ContentTemplate>
<igtbl:UltraWebGridID="UltraWebGrid1"runat="server"Height="200px"Width="468px"style="left: 1px; top: 226px">
</igtbl:UltraWebGrid>
</ContentTemplate>
</asp:UpdatePanel>

Could someone please suggest on this? Is the problem with User Controls??

Guys,

I added the script manager in my Master Page and then added scriptManagerProxy at my user controls which resolved the problem.

Cheers,

Ashish

Tab Control - not saving active tab on postback

I have a tab control and this is more of an annoyance than anything right now but when a linkbutton in the current tabpane causes a postback the tab jumps back to its original state

(meaning that the tab index is reset to 0 I guess but any way the tab the user is on changes back to its default setting - the first tab)

Does something need to be set ?

TIA

TheTabs demo does a full postback and shows how the client state is preserved. Not sure why this is not working for you.

yeah i cant quite figure it out eiter since i copied it directly from the toolkit example

here the html if you can think of anything

1<ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="300px" Width="100%" ActiveTabIndex="0">2 <ajaxToolkit:TabPanel runat="Server" ID="Panel1" HeaderText="Table of Contents">3 <ContentTemplate>456<DNN:DNNTREE id="DNNTree1" runat="server" cssclass="CommandButton">7</DNN:DNNTREE>89 </ContentTemplate>10 </ajaxToolkit:TabPanel>1112 <ajaxToolkit:TabPanel runat="Server" ID="Panel3" HeaderText="Index" >13 <ContentTemplate>14 <asp:UpdatePanel ID="UpdatePanel2" runat="server">15 <ContentTemplate >16 <asp:DataList ID="lstIndex" runat="server">17 <ItemTemplate >18 <li><asp:LinkButton ID="lbItemTitle" runat="server" CommandArgument="View">LinkButton</asp:LinkButton></li>19 </ItemTemplate>20 </asp:DataList></ContentTemplate>21 </asp:UpdatePanel>22 </ContentTemplate>23 </ajaxToolkit:TabPanel>2425 </ajaxToolkit:TabContainer>
 
I acutually worked around it with the updatepanel around the datalist in the second panel but it would be interesting to know why it didnt work

Monday, March 26, 2012

Tab Control is throwing an exception on postback

I have a tab container control on my page located within a view. When the view is activated I do a query and dynamically add the tabs based on a query like so:

 DataTable tblCollAttrs = oBAL.GetCollectionAttrs(DetailItemID);foreach(DataRow drowin tblCollAttrs.Rows) { TabPanel collTabPnl =new TabPanel(); collTabPnl.HeaderText = drow["vchAttributeName"].ToString(); relTablContainer.Tabs.Add(collTabPnl); }

So far everything is fine. Now I click an unrelated button which does a full postback that switches the view and I get this exception:Specified argument was out of the range of valid values. Here is where it is crashing in TabPanelCollection.cs:

public new TabPanel this[int index]
{
: get { return (TabPanel)base[index]; }
}

What am I missing here?

Unfortunately, the tab control does not play nice with dynamically added tabs. It does not re-create them during pre-init, and when it goes to set the active tab, you get the error you are seeing because the active tab index is greater than the number of tabs.


Is there anyway around this?


HiI have also this problem.please help me.

Because of this limitation I was unable to use this AJAX control. I ended up creating my own TabStrip control and putting it in an UpdatePanel.

Sorry I don't have a better response.

Tab custom style lost on postback

I just downloaded the new Ajax toolkit Release 10920 and found that my custom style for the Tab control is lost on postback. When the page is first loaded, my tabs look correct, but after postback my tab css style is not fully rendered. It seemed to revert back to the default style. This has been working with all previous toolkit releases.

Below is my custom style which I've copied to my own custom .css file and made a few minor changes :

/*Tab Style*/
/* default layout */
.ajax__tab_default .ajax__tab_header {white-space:nowrap;text-align:left;padding-left:20px;padding-top:10px;}
.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}

/* xp theme */
.ajax__tab_xp .ajax__tab_header {font-family:verdana,tahoma,helvetica;font-size:11px;background:url(../images/tab-line.gif) repeat-x bottom;}
.ajax__tab_xp .ajax__tab_outer {padding-right:4px;background:url(../images/tab-right.gif) no-repeat right;height:21px;}
.ajax__tab_xp .ajax__tab_inner {padding-left:3px;background:url(../images/tab-left.gif) no-repeat;}
.ajax__tab_xp .ajax__tab_tab {height:13px;padding:0px;padding-top:4px;padding-bottom:4px;margin:0;background:url(../images/tab-little.gif) repeat-x;}
.ajax__tab_xp .ajax__tab_hover .ajax__tab_outer {background:url(../images/tab-hover-right.gif) no-repeat right;}
.ajax__tab_xp .ajax__tab_hover .ajax__tab_inner {background:url(../images/tab-hover-left.gif) no-repeat;}
.ajax__tab_xp .ajax__tab_hover .ajax__tab_tab {background:url(../images/tab-hover.gif) repeat-x;}
.ajax__tab_xp .ajax__tab_active .ajax__tab_outer {background:url(../images/tab-active-right.gif) no-repeat right;}
.ajax__tab_xp .ajax__tab_active .ajax__tab_inner {background:url(../images/tab-active-left.gif) no-repeat;}
.ajax__tab_xp .ajax__tab_active .ajax__tab_tab {background:url(../images/tab-active.gif) repeat-x;}
.ajax__tab_xp .ajax__tab_body {font-family:verdana,tahoma,helvetica;font-size:10pt;border:0;padding:0px;background-color:#ffffff;}

Has anyone encountered this problem with the new release?

Thanks,
Jensayato

Hi,

Can you ellabrote more..

So it will be more helpful to solve your problem.

Tab Index and Update Panel

Hi All,

I'm having an issue where any updatepanel that does an async postback IE 7 and IE 6 will lose the tab order when the partial postback occurs.
Below is some example code you can paste into a new code page and view the issue. Just run the page in IE and tab, it will work correctly, but if you push the button which does a small postback you will notice the tabindex reset itself. Can anyone explain this or possibly confirm this is a bug. Ive seen numerous posts that discuss this but only give a javascript solution. It seems like IE should handle this correctly considering firefox does

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
</head>
<body>
<formid="form1"runat="server">
<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanelID="upnlTest"runat="server"UpdateMode="conditional"><ContentTemplate>
<asp:TextBoxID="txtTest"runat="server"AutoPostBack="true"TabIndex="1"></asp:TextBox>
<asp:ButtonID="tstButton"runat="server"TabIndex="2"Text="Push Me"/>
</ContentTemplate></asp:UpdatePanel>
<asp:TextBoxID="txtTest2"runat="server"TabIndex="3"></asp:TextBox>
</form>
</body>
</html>

Any thoughts or help with this would be appreciated.

TIA,

AjaxButter

I'm having the same problem, any solutions?

Could you use server side code and re-establish the tab order?

txtTest.TabIndex="1"

txtTest2.TabIndex="2"


Do you need to have the AutoPostBack="true" in the txtTest TextBox? That seems to be what is causing the problem. As soon as you tab out it fires a __doPostBack().
You could try adding a trigger for the txtButton Button and setting the UpdatePanel to have the attribute ChildrenAsTriggers=false, this will let you tab through the fields without having the postback lose your focus.

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>Untitled Page</title>
</head>
<body>
<formid="form1"runat="server">
<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanelID="upnlTest"runat="server"UpdateMode="conditional"ChildrenAsTriggers=false>
<Triggers><asp:AsyncPostBackTriggerControlID=tstButtonEventName=click/></Triggers>
<ContentTemplate>
<asp:TextBoxID="txtTest"runat="server"AutoPostBack="true"TabIndex="1"></asp:TextBox>
<asp:ButtonID="tstButton"runat="server"TabIndex="2"Text="Push Me"/>
</ContentTemplate></asp:UpdatePanel>
<asp:TextBoxID="txtTest2"runat="server"TabIndex="3"></asp:TextBox>
</form>
</body>
</html>

Cheers,
Al


I havn't tested this but I read somewhere on these forums before that placing the tab control within an update panel will make it hold its tab index after a partial postback.

But as I said I dont know if this works. Let us know if it does.....


Ignore my previous post, I read your initial post too quickly and thought it was about the tab control.

Yes I have the same issue with loosing the tab index on the controls after a postback. I think there is scriptmanager.setfocus command you can use to reset the focus...


Well first off just want to say thanks for the replies. As far as setting the code server side that doesn't work even with making the call it still sets you into the address bar. As far as Al goes I need to have the postback as some code is firing that is needed, Also mind you that the tabbing stays correct in firefox even with the postback as you would expect. As far as the scriptmanager.setfocus I considered using this but I have around 50 controls on a page which means i would have to setup one per postback. Times that around 40 pages and that equals a lot of work. I truly think this should be considered a bug unless someone at microsoft our in there development teams can tell me possibly what im doing wrong or confirm this is an issue.

Any help with this is greatly appreciated.

AjaxButter


Hi AjaxButter,

Is it possible to replace the AutoPostBack and handle it through some JavaScript? You could at least get around having the issue of the PostBack losing your field focus. You could execute script in JavaScript with an onBlur event handler and take care of any of your PostBack needs that way. It might mean changing a lot of how you are doing things now, but the data from the TextBox could be web serviced back via JavaScript and you could achieve the same processing on the server. It seems like a lot of work though just to fix a tab focus issue.

Depending on how complicated your form is you could use some JavaScript to simply keep track of the most recently focused field and when the UpdatePanel finishes updating simply bring the focus back to that particular field. It wouldn't take much, you just need to set a variable with the latest form DOM field either when that field gets onFocus or onBlur and then bring the focus back after the UpdatePanel updates:

<

scripttype="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
function pageLoaded(sender, args){
if (args.get_panelsUpdated().length > 0){
$get(LASTFOCUSEDFIELD).focus();
}
}
</script>

That example above is a bit 'simple' and there are better detailed uses of the PageRequestManager class here:
http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/default.aspx

I'm probably starting to go way down a path you won't want to venture down. Haha... I'm starting to ramble, but hopefully these ideas may help. :)

Al


Al,

First off just want to say thanks for the reply back. As far as your two suggestions we are nearing completion on this site and there is probably close to 30 pages and each page has various functionality that postbacks at various times. To create a web service would be an entire redesign of the site which is just not an option. Also that seems to me as defeating the purpose of using ajax and partial rendering as you would essentially be writing code which does what their code is doing only slightly different. The only thing wrong with your second suggestion is if I have the tab go back to the field it just left in some instances it would just recause the postback to occur when you again retabbed from that field. We have actually thought about going that way but it would be a lot of work as we would need to put the name of the next field in the tab order on the fields onblur event that comes before it. Daunting task when each page has roughly 100 controls on it. I guess I was dreaming in hopes that maybe someone could tell me yes this is a bug in IE and it should be getting fixed.

I have a feeling if I don't get any better suggestions soon we will have to just keep pushing on.

Thanks,

AjaxButter


Here a workaround is explained:

http://www.codeproject.com/useritems/MainatinFocusASPNET.asp?df=100&forumid=384902&exp=0


Thanks for the reply I will give that a shot as it sounds simple enough to implement. I still think this is a bug that should be fixed. The only thing that concerns me with this solution is the fact your having to add the script call to almost every control and the settimeout call, granted its a short one. I'm wondering if its going to have a performance hit with it as we are already doing recursive ui loading from business objects. Either way I'll give it a shot.

AjaxButter


i have written a post on CodePlex to solve that problem...

http://www.codeplex.com/WorkItem/View.aspx?ProjectName=AtlasControlToolkit&WorkItemId=7194

I hope it helps

Cheers!Cool


Well I checked out your workaround and it looks like its unrelated to the issue in this thread. The issue in this thread is that an asynchronous postback causes IE to reset the tabbing back to the address bar if tabindex is set on your fields and a async postback occurs. The issue you posted in regards to was the tabcontainer. As far as the issue goes I decide to go with my own workaround that takes place in my masterpage. I record the field id posting back when its async and find the next field in the tab order based on tabindex and then use scriptmanager.setfocus passing the next control in the tab order. very cludgy and still think that microsoft should consider looking into this issue as firefox works perfectly.

AjaxButter


you are right!,i have written in a wrong post.Confused

Sorry!


I also have same prblm.

Saturday, March 24, 2012

Tabcontainer - Setting focus on tabs after postback

Is it possible to set the focus to a specific tab after postback or in event handlers.

Any help with this problem will be greatly appreciated.

me.TabContainer1.Tabs(index).Focus, there is an ActiveTabChanged event in the code behind as well.

Is that what your looking for? Also a new video has been posted on the tabContainer in the video's section of this site.

Burl

TabContainer + ActiveTabChanged + __doPostBack Problem

I have a tabcontainer that i want to postback only when certain tabs are clicked (lets call them "postback tabs")

Here is the setup:

<ajax:UpdatePanel ID="upOuter" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<act:TabContainer ID="TabContainer1" runat="server" CssClass="MyTabStyle" ActiveTabIndex="0" OnClientActiveTabChanged="ActiveTabChanged">
....
....

<script language="javascript" type="text/javascript"
function ActiveTabChanged(sender, args) {
var ht = sender.get_activeTab().get_headerText();
if ((ht =="TabHeader1") || (ht =="TabHeader2") || (ht =="TabHeader3") ){
__doPostBack('<%= tabcontainer1.ClientID %>', sender.get_activeTab().get_headerText());
}
}
....
....

Server Side:

Protected Sub TabContainer1_ActiveTabChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles TabContainer1.ActiveTabChanged

If TabContainer1.ActiveTab.HeaderText = "TabHeader1"Then
....
....
End If
If TabContainer1.ActiveTab.HeaderText = "TabHeader2"Then
....
....
End If
If TabContainer1.ActiveTab.HeaderText = "TabHeader1"Then
....
....
End If
End Sub

This actually works quite well except in the following case:

Step 1. I click on one of the postback tabs

Step 2. Click on a non-postback tab

Step 3. Click back on the tab from step 1.

When I do this, the client side script runs, but the postback never happens. If on step 2, i clicked on a postback tab, everything works fine. Or, if on step three I click on a different postback tab than in step 1, everything works fine.

Any ideas?

Figured out the problem. The postback IS happening, but the server-side activetabchanged event was not firing. The reason for this is that when I clicked on a non-postback tab, the server was not notified of the change in activetab. So, following the steps in the original post, when I click back on to the postback tab in step 3 (the same as the postback tab in step 1), the server thinks the active tab is still the same - since it was not notified of the change in step 2. Hence, ActiveTabChanged does not fire on the server-side.

TabContainer and Firefox 2.0.0.2 Postback Issue

After updating Firefox to 2.0.0.2 yesterday, all my TabContainers have stopped functioning. Whenever a postback occurs, the entire TabContainer disappears and I get a javascript errorError: Sys.InvalidOperationException: Component 'ctl00_ContentPlaceHolder1_TabSet1' was not found.

Tested in IE 7 and they continue to work, and they were working fine until updating to the new version of Firefox.

It appears to do it only when the tabcontainer is inside an updatepanel, not when the updatepanel is inside the tabcontainer

This has become a problem for me - I had to remove all update panels that I had associated with my TabContainer control. Here is a little more info on the problem:

Repro:
In FireFox 2.0.0.2 only...
See below for .aspx file to test against. In short, put a TabContainer inside of an update panel, cause a post back to occur.

Expected:
Postback should occur normally, tab container is updated inline.

Actual:
Javascript exception is thrown, Error.invalidOperation() , in file (I believe) MicrosoftAjax.js, function function Sys$Component$_setReferences(component, references) .

Notes:
* http://www.mozilla.com/en-US/firefox/2.0.0.2/releasenotes/
* Stepping through the code actually seems fine - but I've not done much debugging in this particular portion of Ajax.


<%-- Sample, broken TabContainer inside of Update Panel --%>

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><html><body><form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="Server" /> <asp:UpdatePanel runat="server" ID="updatePanelForTestControl" UpdateMode="Conditional"> <ContentTemplate> <ajaxToolkit:TabContainer runat="server" ID="Tabs" ActiveTabIndex="1"> <ajaxToolkit:TabPanel runat="Server" ID="Panel1" HeaderText="Tab 01"> <ContentTemplate> First tab panel </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel runat="Server" ID="Panel2" HeaderText="Tab 02" > <ContentTemplate> Second tab panel <asp:Button ID="Button1" runat="Server" Text="Post Back" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </ContentTemplate> </asp:UpdatePanel></form></body></html>

I'm not sure who owns the responsibility here - if it's an update panel issue, or a TabContainer issue. As such, I posted an "issue" on the AjaxControlToolkit forums:

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=8532

Regards,
Kevin


Investigation is ongoing. What appears to be the case is that the Firefox 2.0.0.2 update changed the ordering of two browser events UpdatePanel uses in such a way as to break certain aspects of ASP.NET AJAX. Microsoft folks are looking into the issue now and should update this thread (or maybe post a new, sticky one) once they know more.


that is casewe are working with the firefox team actively to figure out the best approach to address this issue and we will update this thread as soon as we know more about it.

Just to expand on this, my customers have told me of problems with Telerik RadAJAX and MagicAJAX when FireFox 2.0.0.2 was installed.

Telerik has already published a fix:http://www.telerik.com/community/forums/thread/b311D-tccek.aspx

I have yet to validate the MagicAJAX problem.

From my perspective as a custom controls developer, it sounds like FireFox did a bad thing because they've broken a lot of AJAX-based sites.


FYI, the ASP.NET AJAX team will be tracking this issue here:http://forums.asp.net/thread/1600941.aspx

Please check there for up-to-date information.


It seems that in FireFox 2.0.0.2 dynamically loaded javascript files (much needed by all AJAX frameworks) are handled in a completely different fashion, whici as far as I can see is causing major problems fror all AJAX frameworks. The guys from telerik are ready with the update and created a hotfix (Q4 SP2) - so if you are using telerik r.a.d.ajax - just upgrade. I'm sure Microsoft guys will respond as quickly as possible as well (and I am well aware that for company like Microsoft and for product like ASP.NET AJAX this will take some time).

Here is the bug I believe is related (since I've seen most AJAX libraries use the innerHTML approach for dynamically loading javascript under the hood).

https://bugzilla.mozilla.org/show_bug.cgi?id=371628

Wednesday, March 21, 2012

TabContainer hidden on postback!

i have a page that is derived from a master page. The page contains a tabContainer with three TabPanels. Each of the TabPanels contains an updatePanel.

One of the updatePanels contains a TabContainer with two Tabpanels that contain CascadingDropdowns. Everything works fine till i perform a postback

from within the update panel. Upon return the inner most tabContainer is hidden -- i can see it in ViewSource, but it is set to hidden and display of none.

There are no exceptions in the code. The Page Load event completes perfectly, the event handler for the button that causes the postback executes

perfectly. everything works, except that the tabContainer is "gone"...

If i remove the UpdatePanel that contains the tabContainer then everything works. Putting back the UpdatePanel causes the inner TabContainer to

disappear on postback even though everything works in the code behind. I tried to explicitly set the TabContainer to enabled and visible in Page Load

event to no avail. I do not know if the fact that the page is derived from a master page makes a difference.

summary of hierarchy

MasterPage

-- ClientPage

-- TabContainer

-- TabPanel

-- UpdatePanel -->this seems to cause the problem on postback.

-- TabContainer --> disappears on postback

-- TabPanel --> this works, has no TabContainers

-- TabPanel -->this works, has no Tabcontainers

Help??!!!


i found the solution to all the problems i've been having with tabs disappearing upon deployment.

Turns out the microsoftajax.js was different. Reinstalling Ajax extensions fixed it. The problem i

have with this is that this was the released v1.0 that was installed. The machine had no atlas, no

previews, no nothing before Ajax 1 was installed on it few weeks ago. Downloading and re-installing

fixed it, but clearly installed a different set of files... The hint that finally got me to this path was

issues with sys.debug that were not related to caching the js files in the browser nor in IIS.



I downloaded the latest controltoolkit.dll, however, I am still having the same problem with firefox as you had above.

Any suggestions?

Thanks


Hi,

If anyone is still having this issue....

Firefox had a bug. I just downloaded the latest release of Firefox from this link: (I guess it is not officially released?)

ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2007-03-09-19-firefox2.0.0.3

In the new Firefox, the tabContainer seems to work fine.

Thanks

Tabcontainer Postback Problem.

Hi friends,

I have a tabcontainer with six tabs in it. each tab has got a usercontroll. when i update contents in one tab it automaticaly loads all usercontrols in all six tabs . this slows down my application.i ahve wrapped each usercontrol with update panel with update mode = "conditional", still its not working. any idea on how to stop postback on other tabs when in update one tab.

Thanks

sandsanz

is your server side page_load wrapped in a page.ispostback? (in main page and all user controls?) is your outermost update panel set to conditional too? i've got the same scenario with tab controls and update panels (update containing 6 tabs containing updates and some with more tabs and updates) and it took some playing to get it to work right. All user controls load on the content page's page load and only reload on exposed methods...


Thanks Friend,

Actually my tabcontainer is not in update panel.. but each tabpanels inside it are in update panel with update mode condition. and all my usercontrols contains gridview.if i update one gridview in one usercontrol. it updates all usercontrols and application is terribly slow coz of that.i appreciate ur help.

Thanks


how do you originally load the grids and how are you updating the grids? (events?)


Hi,

Thank you for your post!

Are you create your usercontrols dynamically on the Init Event?

If so, no way to avoid the issue. I suggest you create your usercontrols at Design Time.

If not, create a simple repro of your problem for us, I cann't understand you well.

If you have further questions,let me know!

Best Regards,