• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1446
  • Last Modified:

Asp.net AJAX According Panel with GridView

Hello to all its been a while and I am stuck on this one.
Ok here it is.
First and foremost I have a gridview which works perfectly. When I mean perfectly I mean you can update/delete/select/index change / etc. This gridview is part of a usercontrol which I call on my page.

Now the problem is when I put this gridview in an Ajax Accordian Panel which makes the
users can click on the panel to slide up or down. When the Users decides to click on the next page index, or Edit controls I get this error
"Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. "

Again this only happens when I put the gridview within the Accordian Panel..if I don't have it in there then I get no error at all.

Is there a solution to this madness LOL.
Thanks in Advance guys for helping this noob :).

This is my Front End Code for the accordian panel..which my gridview is pullout of a user control
<cc1:Accordion ID="AccordMain" runat="server">
                <cc1:AccordionPane ID ="AccordColor" runat ="server">
             <Header><div class ="TitleRoll"  style="display:block; border:2px navy outset;   color:White;"> Add / Edit Color </div> </Header>
                  <ucIntCol:ucIntColors ID ="UcColor" runat ="server" />

Open in new window

  • 2
1 Solution
Hi There,

What version of .net are you using? What server os is the application running on?

saruman101Author Commented:
I'm building this web application with visual studio 2008 .net framework 3.5
My current OS is windows 7 RC which is on my desktop.
And as for my web server right now I'm just currently using the built in version of Visual Studio so I'm not using IIS yet.
If u need to add a different control on each postback to the same placeholder don't do that and instead make a different placeholder for each different control and each control should be added to a certain placeholder (don't add different kinds of control to the same placeholder at the same location)


You can set enableviewstate=false on the control if u don't need the viewstate
saruman101Author Commented:
Hey guys I figure it out...and I guess it was by luck.

Ok first of all I do have different controls on different placeholders and the only one that was giving me the problem was the gridview itself.Well it turns out to be that in my user control within the grid view I had a small DIV tag which for what reason I don't remember why I had that there but it was there.

So when I would put the user control into the accordian pane it would then include the div as well within inside the accordian. When I would click on anything within the grid whether it was to update/paging/etc I would get the error. As soon as I remove the DIV tag everything works as it suppose to be.

Thanks guys for your help and advice :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now