Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedError when trying to load the edit.ascx controlError when trying to load the edit.ascx control
Previous
 
Next
New Post
10/22/2013 10:24 AM
 

Hi,

I am creating a simple module where I have have a list on the view.ascx control and currently I have an 'Add New' button.

The button calls in the click event

 Response.Redirect(EditUrl(string.Empty, string.Empty, "Edit"));

 When I click on the button I get the following error:

 Corrupted Content Error
The page you are trying to view cannot be shown because an error in the data transmission was detected.

 

Looking in the event viewer, the following error is displayed :-
 

DotNetNuke.Services.Exceptions.ModuleLoadException: 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. ---> System.Web.HttpException: 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. at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.Modules.Events.Events.LoadModuleControl() --- End of inner exception stack trace ---

If I go into the module settings and turn off the "supports popups" option for the EDIT control it works perfectly. 

I am using DevExpress 13.1 asp.net controls in this module. Could they be interferring?

This is with DNN version 07.01.02 (356)

 
New Post
10/22/2013 10:58 AM
 

Some additional information.

 I have removed all references to DevExpress from the web config and the module and it still does not work.

 
New Post
10/23/2013 6:47 AM
 
Also I am using Chris Hammonds module templates (latest version).
 
New Post
10/23/2013 9:48 AM
 

Can anyone explain this code please?

        protected void rptItemListOnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                var lnkEdit = e.Item.FindControl("lnkEdit") as HyperLink;
                var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton;

                var pnlAdminControls = e.Item.FindControl("pnlAdmin") as Panel;

                var t = (Item)e.Item.DataItem;

                if (IsEditable && lnkDelete != null && lnkEdit != null && pnlAdminControls != null)
                {
                    pnlAdminControls.Visible = true;
                    lnkDelete.CommandArgument = t.ItemId.ToString();
                    lnkDelete.Enabled = lnkDelete.Visible = lnkEdit.Enabled = lnkEdit.Visible = true;

                    lnkEdit.NavigateUrl = EditUrl(string.Empty, string.Empty, "Edit", "tid=" + t.ItemId);

                    ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile));
                }
                else
                {
                    pnlAdminControls.Visible = false;
                }
            }
        }


        public void rptItemListOnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                Response.Redirect(EditUrl(string.Empty, string.Empty, "Edit", "tid=" + e.CommandArgument));
            }

            if (e.CommandName == "Delete")
            {
                var tc = new ItemController();
                tc.DeleteItem(Convert.ToInt32(e.CommandArgument), ModuleId);
            }
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
        }

 

Why are there 2 parts where EditUrl is executed. Is one for the popup version of the edit page?

 If so, how do I dynamically set a buttons client side click event to do the same? It does not have a NavigateUrl property.

 
New Post
10/24/2013 6:19 AM
 

OK. Getting somewhere now I have got debugging working again :-)

The following line in my code behind onclick event

  Response.Redirect(EditUrl(string.Empty, string.Empty, "Edit", "tid=6"));

Results in the following code being added.

  dnnModal.show('http://www.dnndev.me/Viewstate-test/ctl/Edit/mid/573/tid/6?popUp=true',/*showReturn*/false,550,950,true,'')

 I can fully understand why this results in an error.

 The question becomes how can I have an 'Add' button on my page which loads the edit control correctly either for popup or normal loading of the page?

 Regards

 

Mike

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedError when trying to load the edit.ascx controlError when trying to load the edit.ascx control


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out