Don't miss out Virtual Happy Hour this Friday (April 26).
Don't miss out Virtual Happy Hour this Friday (April 26).
Maybe the validation for PageName kicks in? Or are you getting a postback?
Yes I do get a postback, but for some reason it wont step into the click-function.. and the same goes if I enter a name for my page and fills in all the other properties and press the button.
OK. Are you adding the button from CreateEditControls()?
People can help better if you post the code.
No, its added directly in the user-control only.
And my bad.. its not an asp:button.. ist an EPiServerUI:ToolButton..
Well the code is:
<asp:UpdatePanel ID="upPanel" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:MultiView runat="server" ID="mvList">
<asp:View runat="server">
<table>
<tr>
<th><b>Key</b></th>
<th><b>Value</b></th>
<th></th>
</tr>
<asp:Repeater runat="server" ID="rpKeysAndValues" OnItemCommand="rpKeysAndValues_OnCommand" OnItemDataBound="rpkeysAndValues_OnDataBound">
<ItemTemplate>
<tr>
<td>
<asp:TextBox runat="server" Text='<%# Eval("Key")%>' AutoPostBack="True" ID="tbEditKey" OnTextChanged="tbEditKey_OnTextChanged"></asp:TextBox></td>
<td>
<asp:TextBox runat="server" Text='<%# Eval("Value")%>' AutoPostBack="True" ID="tbEditValue" OnTextChanged="tbEditValue_OnTextChanged"></asp:TextBox></td>
<td>
<EPiServerUI:ToolButton SkinID="Delete" runat="server" CommandName="delete" Text="Delete" ID="btnDelete" CommandArgument='<%# Eval("Key") %>'></EPiServerUI:ToolButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:View>
<asp:View runat="server">
<b>No items added!</b>
</asp:View>
</asp:MultiView>
<br />
<br />
<asp:Panel runat="server" ID='pAdd'>
<table>
<tr>
<td>Key: </td>
<td>
<asp:TextBox runat="server" ID="tbKey"></asp:TextBox></td>
<td> </td>
<td>Value: </td>
<td>
<asp:TextBox runat="server" ID="tbValue"></asp:TextBox></td>
<td colspan="2">
<EPiServerUI:ToolButton ID="BtnAdd" runat="server" SkinID="Add" Text="Add" OnClick="BtnAddClick" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
and the only code on the server-side that relates to the button is this:
protected void BtnAddClick(object sender, EventArgs e)
{
_list.Add(tbKey.Text,tbValue.Text);
SaveListToViewState();
SaveChanges();
PopulateRepeater();
}
Thanks!
We also need the code that inherits PropertyString or other propertytype... If you haven't already take a look at Joel's post on custom properties:
http://joelabrahamsson.com/entry/how-to-create-a-custom-episerver-property
[PageDefinitionTypePlugIn(
DisplayName = "Dictionary",
Description = "Used to create a list with objects containing a key and a value")]
[UserControlProperty(
EditUserControlPath = "/Templates/Web/Controls/CustomProperties/Dictionary/DictionaryControl.ascx")]
public class PropertyDictionary : UserControlPropertyBase<string>
{
}
This is all the code I got.
You could try attaching the events from code behind and see if that helps.
Also try removing the ASP.NET AJAX stuff (UpdatePanel) and see what happends then - I don't trust that functionality at all.
The UserControlPropertyBase is something from ETF right? You could ask those guys for support as well.
I would personally have chosen to add controls from codebehind and not use a user control.
Hi!
First time here.. so please correct me if Im doing something wrong :)
My propblem is that Im having this custom propertytype that I have built, the property has a normal asp:button with a click-event bound to it (a serverside click-event).
This button adds an item into a list.. but I wont go into the details regarding that since thats not the problem.
The problem is that if I create a new page with the pagetype that contains the custom propertytype, and then try to press the asp:button, the click-event wont fire.. but If I save my page and then press/click the asp:button, the event fires.
Any thoughts or ideas?
Thanks in advance!