Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sachin 22 posts 41 karma points
    Apr 22, 2011 @ 11:57
    sachin
    0

    moving to another page on button click

    Hello everyone,

    I am  newbie to umbraco.i have made a "contact us" form usercontrol which is working fine.

    But now i want that after click on submit button, a message like "Thanks for contact us" display on next page in umbraco.

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 22, 2011 @ 12:22
    Jan Skovgaard
    0

    Hi Sachin

    I believe you can do that in your user control on the button_click event, which you're probably already using...

    in there you can make a check on your button to see if it has been clicked or not.

    If it has been clicked you can choose to display a text.

    Does it make sense or do you need a code sample? :-)

    /Jan

  • sachin 22 posts 41 karma points
    Apr 22, 2011 @ 12:36
    sachin
    0

    Thanks for reply jan,

    its better if u plz provide a code sample...

  • Pasang Tamang 258 posts 458 karma points
    Apr 22, 2011 @ 12:48
    Pasang Tamang
    1

    Hi Sachin

    You can do this like this way

     

            protected void btnSubmit_Click(object sender, EventArgs e)
            {
    <!--- Here goes your contact code--->
    Response.Redirect("thankyou.aspx");
    }

    but be sure that thankyou page is in your umbraco backoffice. One more suggestion, if you want to show message within the usercontrol (without navigating to thank you page), better use wizard control.

    Thanks

    Pnima

     

  • sachin 22 posts 41 karma points
    Apr 22, 2011 @ 13:15
    sachin
    0

    thanks pasang brother.....

  • Seth Niemuth 275 posts 397 karma points
    Apr 22, 2011 @ 16:03
    Seth Niemuth
    0

    You can also use the umbraco node factory and use the node Id of the page, that way if someone changes the name, then it will still go to the correct page (where 1111 is your NodeId):

    protected void btnSubmit_Click(object sender, EventArgs e)
           
    {
                    <!--- Here goes your contact code--->
                    Response.Redirect( new umbraco.NodeFactory.Node(1111).NiceUrl);
            }

     

    Also, if you don't want to go to a new page, you can just do panels on your ascx control rather than the wizard and just set the form panel to hidden when they have submitted and the thank you panel to visible to visible.

    So your aspx page would have:

    <asp:Panel ID="pnlForm" runat="server" DefaultButton="formButton">
    <!-- all your form fields-->
    </asp:Panel>

    <asp:Panel ID="pnlThankYou" runat="server" Visible="false">
    <asp:Label runat="server" Text="Thank you for submitting your form" />
    </asp:Panel>

     

    Then in your code behind

     

    protected void btnSubmit_Click(object sender, EventArgs e)
           
    {
                    <!--- Here goes your contact code--->
                   pnlForm.Visible = false;
    pnlThankYou.Visible = true;
            }

     

     

Please Sign in or register to post replies

Write your reply to:

Draft