Set property with DropDownList Type from C# code Options
igorbel
Posted: Friday, January 11, 2008 8:10:40 PM
Rank: Enthusiast

Joined: 1/4/2008
Posts: 26
Hello!

I`ve created data type based on Dropdown list with three prevalues and included it in my document type. Now I need to create this document from my code on C# and set value for this property. There are some textstring properties in the document type and I have no problem with them. But when I`m trying to set dropodown list property:

Code:

Document d = new Document(pageId);
            Document q = null;
            User admin = new User(0);
            q = Document.MakeNew("question_" + (lastQuestionNumber+1), DocumentType.GetByAlias("M Question"), admin, d.Id);
            if (q != null)
            {
                q.getProperty("questionContent").Value = txtboxQuestion.Text;
                q.getProperty("EnquirerId").Value = m.Id;
                q.getProperty("EnquirerName").Value = "temp";

                q.getProperty("EnquirerGroupName").Value = "Students"; // problem here
                q.Publish(admin);
                umbraco.library.PublishSingleNode(q.Id);

                Response.Redirect(umbraco.library.NiceUrl(d.Id), true);               
            }


Textstring properties "questionContent", "EnquirerId" are published right, but "EnquirerGroupName" is saved as "<![CDATA[]]>" in the umbraco.config. When I publish this page through admin interface this property saves as "<![CDATA[Students]]>".

How should I get values from my Data Type (DropDownList) to publish document programmaticaly?

Thanks!

Igor Bel
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.