DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Custom DNN Module dynamic form

Sort:
You are not authorized to post a reply.





New Around Here





    I'm developing a custom module in DotNetNuke 9.9 using Chris Hammond's Module Templates (they're great btw). So far, everything is going well, but I've hit a brick wall with a specific customer requirement: They want to be able to dynamically add additional controls to the form - multiple file upload controls. An example of what I want to achieve can bee seen here: https://www.aspsnippets.c...and-VBNet-in-ASPNet/

    For each file that is to be uploaded, they want a textbox to enter the description of the file. The form itself has several other input fields with RequireFieldValidators on them.

    I have created a server-side asp:table and my idea was to simply add a new TableRow when the user clicks on the Add File button on the page. The TableRow would consist of 3 TableCells - one with the FileUpload control, one with a textbox for the description, and 1 with a button to allow them to Remove the row if they require. The module has been defined to support Partial Rendering.

    This is what the section of the ascx looks like:

    <div class="dnnFormItem">
        <dnn:label id="lblAttachments" runat="server" />
        <div class="editItem">
            <asp:Table ID="tblAttachments" runat="server" >
                <asp:TableHeaderRow ID="thrAttachments" runat="server" >
                    <asp:TableHeaderCell ID="hdrFileName" runat="server" Width="35%" HorizontalAlign="Left" Text="File Name" />
                    <asp:TableHeaderCell ID="hdrDescription" runat="server" Width="35%" HorizontalAlign="Left" Text="Description" />
                    <asp:TableHeaderCell ID="hdrRemove" runat="server" Width="5%" HorizontalAlign="Right" />
                </asp:TableHeaderRow>
            </asp:Table>
        </div>

        <div>
            <asp:linkButton ID="lnkAddFile" resourcekey="lnkAddFile" OnClick="lnkAddFile_Click" runat="server" Cssclass="dnnSecondaryAction" />
        </div>
    </div>

    The problem I have is that when I click the Add File button, the validators all fire and display error messages for missing data etc. and the server-side code used to add the row to the table is not actually called.

    How can I call the server-side function to add a new row each time the button is clicked without the for actually posting back to the server and triggering the validators? This should only happen when the entire form is actually submitted with the Submit button

    What am I missing here?
    How do I get this button to call the backend via ajax and have the backend manipulate the table?

    Thanx, Alon

    You are not authorized to post a reply.

    These Forums are dedicated to the discussion of DNN Platform.

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

    1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
    2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
    3. 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.
    4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
    5. No Flaming or Trolling.
    6. No Profanity, Racism, or Prejudice.
    7. Site Moderators have the final word on approving / removing a thread or post or comment.
    8. English language posting only, please.

    Would you like to help us?

    Awesome! Simply post in the forums using the link below and we'll get you started.

    Get Involved