I am using Umbraco v 4.0.2.1 with .Net framework 3.5. I've a User Control and made a Macro for the same and have added all the properties of the User Control, which are now listed in Parameter.
As you can see I've NoOfQuotes and the type is number it shows a text box. I want user to provide No of Quotes not more than 3 but since the control is textbox it can provide more than 3. I want to know how can I overcome with this problem.
Hi, Thanks for your reply. I visited the link that you provided and followed the steps. Now, the problem arises I've DropDownList with value 1 and 2. if I select 2 and click ok it's not retaining it again shows 1. What should I do to make this retain it's value.
While working on an older installation (4.11.10) I ran in to this issue so I thought I'd just share my findings.
And it seems that the set method of Value is called before the items are added. Therefore, you need to add the items before calling this.SelectedValue = value;.
I added a private method to call in the constructor and in the set method.
public string Value
{
get
{
return this.SelectedValue;
}
set
{
AddItems();
this.SelectedValue = value;
}
}
private bool ItemsAdded
{
get
{
return this.Items.Count > 0;
}
}
private void AddItems()
{
if (!ItemsAdded)
{
this.Items.Add(new ListItem("Text 1", "Value1"));
this.Items.Add(new ListItem("Text 2", "Value2"));
}
}
Need "DropDownList" in Macros parameter type.
Hello all,
I am using Umbraco v 4.0.2.1 with .Net framework 3.5. I've a User Control and made a Macro for the same and have added all the properties of the User Control, which are now listed in Parameter.
As you can see I've NoOfQuotes and the type is number it shows a text box. I want user to provide No of Quotes not more than 3 but since the control is textbox it can provide more than 3. I want to know how can I overcome with this problem.
You need to create a custom macro property type see http://www.richardsoeteman.net/2010/01/04/CreateACustomMacroParameterType.aspx on how to do this.
Regards
Ismial
Hi, Thanks for your reply. I visited the link that you provided and followed the steps. Now, the problem arises I've DropDownList with value 1 and 2. if I select 2 and click ok it's not retaining it again shows 1. What should I do to make this retain it's value.
While working on an older installation (4.11.10) I ran in to this issue so I thought I'd just share my findings.
And it seems that the
set
method ofValue
is called before the items are added. Therefore, you need to add the items before callingthis.SelectedValue = value;
.I added a private method to call in the constructor and in the
set
method.Otherwise, my code is similar to the code on this page: http://www.richardsoeteman.net/2010/01/04/CreateACustomMacroParameterType.aspx
is working on a reply...