Copied to clipboard

Flag this post as spam?

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


  • Muhammad Tahir 12 posts 33 karma points
    May 11, 2012 @ 03:41
    Muhammad Tahir
    1

    Accessing contour Form records in usercontrol

    Hi,

    I am new to umbraco contour and here is my situation:

    I have multiple forms which are only accessable to umbraco members. When a member submits a form, I store their umbraco memberId as an entry. Instead of using the back office to see if a member has submitted the form, I am planing to develop a usercontrol that would grab this data from contour.

    Is there any example around of what Im planning to do? If not, I would appreciate if someone can direct me to the right direction to get me started.

    Thanks.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    May 16, 2012 @ 12:31
    Tim
    1

    Hiya,

    Contour has an API that you can use to query and get records out. You can also query it as XML for speed if you prefer. There are examples of how to use the API in the developer docs, which you can grab from here. You should be able to use those to work out the code that you need!

    :)

  • Muhammad Tahir 12 posts 33 karma points
    May 18, 2012 @ 02:44
    Muhammad Tahir
    0

    Hi Tim,

    Thanks for letting me know about the dev doc. I already had read it but since I prefer to develop in c# so I didn't use the xml. Currently I am using the following logic to redirect members if they have already submitted a form

                if (Member.IsLoggedOn())

                {

                    RecordStorage rs = new RecordStorage();                

                    Member m = Member.GetCurrentMember();      

    String currentMember = "";

    currentMember = m.Id.ToString();         

                    Guid form_guid = Guid.Parse("FORM_UUID");

                    Listform_records = new List();                

                    form_records = rs.GetAllRecords(form_guid);

                    foreach (Record r in form_records)

                    {

                        String member = "";

                        member = r.GetRecordField("memberId").ValuesAsString();

                        if (member.Equals(currentMember))

                        {

                            Response.Redirect("/");

                        }

                    }

                }

    I want to render the form in user control if the user have not submitted it. any idea how can i achieve that?

    Because later on I have to display multiple forms on the same page. So it will be clean if I can show/hide the required forms in one user control instead of creating separate user control for each form.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft