Passing complex parameters to a .Net UserControl Options
clevster
Posted: Thursday, November 13, 2008 10:55:14 PM
Rank: Newbie

Joined: 4/21/2008
Posts: 12
How would one go about passing a ContentTree parameter into a .Net UserControl. I am trying to traverse the node tree.

My goal is to create a survey-like page and store the user's selected answers in a table outside of the Umbraco tables. I need to traverse a node tree similar to the following. The following represents document types that I've created with their corresponding properties in parenthesis.

Code:
Question List (Columns)
     Question (Question, Required, Single / Multiple Answer)
          Answer (Answer, Text Allowed)
          Answer
          ...
          ...
     Question
          Answer
          ...



Any help would be appreciated. Angel
nwahlberg
Posted: Friday, November 14, 2008 4:43:58 AM

Rank: Devotee

Joined: 10/20/2008
Posts: 83
Location: USA
So, are you simply trying to read the results of people adding nodes to your tree from a particular point forward? Are you using something like Doc2Form for people to submit answers to the survey? If so, you should be able to use the various utility methods available in the umbraco.cms library. Have a look at that namespace and you should find what you need I think.

Thanks,
Nik

Level 1 Certified / www.scandiaconsulting.com
Dirk
Posted: Friday, November 14, 2008 8:23:05 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

I'm quite sure you're looking for this:

http://forum.umbraco.org/yaf_postst6221_Umbarco-API-for-Nodes-in-C.aspx

Look for cpalm's answer, he's using the Node class. In your case, you'll have to replace the Node.GetCurrent() part with something else to get to a specific node in the node tree (Node constructor has a bunch of ctor overloads, of which one takes a Int32)

Hope this helps.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
clevster
Posted: Friday, November 14, 2008 6:12:34 PM
Rank: Newbie

Joined: 4/21/2008
Posts: 12
Hi Dirk,
That's exactly what I'm looking for. I was surprised how quickly and easily it was to implement.

Now my only dilemma is to have the Question property of the Question doc type to be a dropdown list that pulls from a database table. I need to do that same with the Answer property in the Answer doc type. Is there a data type out there that can accomplish this? I'll also need some way of adding questions and answers to the tables... not sure if there's anything out there that can do that either.

Ultimately I need to use three tables.
1) Questions (QuestionId, Question)
2) Answers (AnswerId, Answer)
3) Demographics (RegistrantId, QuestionId, AnswerId)
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.