Developer forum

Forum » Development » Paragraphsettings exception

Paragraphsettings exception

Jais Edelmann
Reply
 Hey im strugling to get paragraphsettings to work for some reason it loads fine and default value can be set on Page load however when i try and reload after save it gets all screwed up even if i only just use one input field as test.

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="codesquare_faq_Edit.aspx.cs" Inherits="Codesquare.CustomModules.codesquare_faq.codesquare_faq_Edit" %>
<%@ Register Assembly="Dynamicweb.Controls" Namespace="Dynamicweb.Controls" TagPrefix="dw" %>
<dw:ModuleHeader ID="ModuleHeader1" runat="server" ModuleSystemName="codesquare_faq" />
<dw:ModuleSettings Value="TEST" ModuleSystemName="codesquare_faq" Runat="Server" />
<html>
<head>
    <style>
        
    </style>
</head>
<body>
<form runat="server">
<input type="text" id="TEST" runat="server" />
</body>
</html>

protected void Page_Load(object sender, EventArgs e)
{
            Properties properties = Dynamicweb.Properties.LoadProperties();
            TEST.Value = properties.get_Value("TEST");
}

When i try to run pageload it just fails after save has been run, i've attached what it actually saves in the database just looks like it saved an exception


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi there,

Take a look at the article series on building modules, part 3 in particular.You don't need the standard html element (such as html. head and body) and you don't need a form element either (and yours is broken too).

Are you using the Templates for Visual Studio? They make creating _Edit pages super simple.

Cheers,

Imar


 
Jais Edelmann
Reply
Hey Imar, yeah but i want to dynamicly create some dw radio buttons so i used a .net placeholder and then attached the controls to that but that needs to be in a form with runat server so thats why i have it

Edit: Oh well i guess i could just remove it and it would work haha! thanks Imar
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
That won't work; your page *is* already placed inside a form with runat= server, by Dynamicweb. Instead, look into user controls for your Edit page or work with stuff like this at the client (e.g. change visibility using divs and CSS for example if this is what you use the PlaceHolder for).

Imar


 
Jais Edelmann
Reply
Yeah i see its not working :/ i was just hoping it was working since i didnt get a error hehe, problem is i wanna use the paragraphsettings because i have to store some settings but i also cant surfice with just divs and css, because the list of radiobuttons is dynamic.

List<Objects.faqcategory> faqcategories = Managers.faqcategoryManager.GetAllCategories();
            foreach (faqcategory fc in faqcategories)
            {
                Dynamicweb.Controls.RadioButton rb = new Dynamicweb.Controls.RadioButton();
                rb.FieldName = fc.Name;
                rb.FieldValue = fc.Id.ToString();

                if (rb.FieldValue == selectedCategory)
                    rb.SelectedFieldValue = rb.FieldValue;
                phCategories.Controls.Add(rb);
            }

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer
Then look at user controls, as I suggested earlier....

Imar

Votes for this answer: 0
 
Jais Edelmann
Reply
 Thanks again Imar :)

At first the usercontrol didnt work for me but triede again here after you said it and now its working as intend'd iguess i must have made a typo.
 
Jais Edelmann
Reply
Just a notice, dynamicweb need's the name of the control to match the paragraphsettings id its not enough to only have the id match, so what i did was use clientidmode static and then change the name to match the id.  Just if anyone else is having trouble gettin it to work. (this is only need'd for controls which arent dw controls)

<script type="text/javascript">
    document.getElementById("controlclientid").name = "controlclientid";
</script>

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
 Which version of Dynamicweb are you running. I thought this was a bug in DW running on .net 4, that has been fixed....

Imar
 
Jais Edelmann
Reply
 Hey Imar,

Im running Application(8.0.2.2)

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Right; in that case, you may want to consider upgrading. This bug was fixed in version 8.1.0.0.

Cheers,

Imar

 

You must be logged in to post in the forum