Developer forum

Forum » Development » Error on loadproperties for custom module

Error on loadproperties for custom module

Keld Gøtterup
Reply
Im getting errors in the custom module im trying to make. the error occurs on paragraphlevel.
In edit mode the error occurs whenever the below line of code is executed.
Properties properties = Dynamicweb.Properties.LoadProperties();
The problem also occurs when i view the frontend and that class only contains 

return

"frontend output"; The error: System.Xml.XmlException: '100' is an unexpected token. The expected token is '"' or '''. Line 20, position 65. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at Dynamicweb.Properties.LoadProperty(String xmlString, Boolean blnKeepRoot, Boolean blnMerge) at Dynamicweb.ContentModule.InitializeModule(DataRow ParagraphRow, PageView Pageview) at Dynamicweb.Frontend.Content.getModule(DataRow& ParagraphRow)


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi there,

Could it be that your paragraph settings contain invalid data, possibly from a previous save operation? What happens when you create a new page and paragrpah and attach the module?
 

If there's no change, can you post the code for the module's Edit page?

Imar

 
Keld Gøtterup
Reply

ive now deleted the paragraph and page. and tried making it again with a stripped edit file
 


when i attach the module i shows as expected and i can save but next time i try to enter the module it gives the error.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DWCMSModule_Edit.aspx.cs" Inherits="DWCMSModule.CustomModules.CMS.DWCMSModule_Edit" %>
<%@ Register Assembly="Dynamicweb.Controls" Namespace="Dynamicweb.Controls" TagPrefix="dw" %>
<dw:ModuleHeader ID="ModuleHeader1" runat="server" ModuleSystemName="DWCMSModule" />

<dw:ModuleSettings id="ModuleSettings1" runat="server" ModuleSystemName="DWCMSModule" Value="" />


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
<script type="text/javascript">

</script>
</head>

<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

 


 
Keld Gøtterup
Reply
when i look in the database i can that the paraphmodulesettings contains an error instead of the Xml it should
 
Pavel Volgarev
Reply
 Hi,

First of all, you should remember that the edit page is basically rendered inside another "master page", so no need for HTML,BODY tags.

Markup:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DWCMSModule_Edit.aspx.cs" Inherits="DWCMSModule.CustomModules.CMS.DWCMSModule_Edit" %>
<%@ Register Assembly="Dynamicweb.Controls" Namespace="Dynamicweb.Controls" TagPrefix="dw" %>

<dw:ModuleHeader ID="ModuleHeader1" runat="server" ModuleSystemName="DWCMSModule"  />
<dw:ModuleSettings ID="ModuleSettings1" runat="server" ModuleSystemName="DWCMSModule" Value="MySetting" />

<dw:GroupBox ID="grlGeneral" Title="General">
    <table>
        <tr>
            <td style="width: 170px">
                My setting
            </td>
            <td>
                <input type="text" name="MySetting" value="<%=Properties.Value("MySetting")" />
            </td>
        </tr>
    </table>
</dw:GroupBox>


Code-behind (simplified):

protected Dynamicweb.Properties Properties { get; set; }

protected void Page_Load(object sender, System.EventArgs e)
{
    this.Properties = Properties.LoadProperties();
}
If you need a full support for server-side events, standard ASP.NET controls, etc. you can create a user control (instead of .aspx page). Read more here: Replacing module edit page with user control.

 
Keld Gøtterup
Reply

Thank you that was of course it.
and thank you for the link im probably gonna need it.
 
Magni J. Hansen
Reply

This is an old post.

I remove this error by removing the <form> tag from the aspx file.

 

You must be logged in to post in the forum