I'm trying to use the DNNMultiuStateBox (DNNMSB); and am running into some ... Let's call them 'complications'.
I'm not logging issues for them right now because I don't know where to log issues for the DNNMSB right now - I don't see a spot for it in the WebControls in Gemini.
Items like **this** are working correctly but I found them relevant to another item, so put them in them.
Clicking on the image doesn't cause a postback (autopostback = true)
Clicking on the image doesn't cause a CheckChanged event
Clicking on the text doesn't cause a CheckChanged event
**Clicking on the text DOES cause a postback when autopostback is set to true**
Clicking on a Disabled (Enabled=False) DNNMSB causes a postback when autopostback is set to true.
DNNMSB in a DataList doesn't keep Enabled=False, if set through DataBind, setting through postback.
DNNMSB with a set SelectedStateKey does not keep changed state through postback.
**DNNMSB without a set SelectedStateKey DOES keep its changed state through postbacks**
DNNMSB 'que's up a CheckChanged event when first created when SelectedStateKey is set through DataBinding.
DNNMSB 'que's up a CheckChanged event when SelectedStateKey is not set.
DNNMSB 'que's up a CheckChanged event when SelectedStateKey is set and Enabled=False.
**DNNMSB does not que up a CheckChanged event when SelectedStateKey is set and Enabled = true.**
MY ASCX PAGE - Important Parts
<%@ Register Assembly="DotNetNuke.WebControls" Namespace="DotNetNuke.UI.WebControls" TagPrefix="DNN" %>
<asp:Label ID="lblDebug" runat="server"></asp:Label><br />
<asp:Panel ID="Panel1" runat="server" Height="200px" ScrollBars="Vertical" Width="250px">
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<DNN:DNNMultiStateBox ID="DNNMultiStateBox1" runat="server" AutoPostBack="True" Enabled='<%# Convert.ToBoolean(Eval("Enabled")) %>' ImagePath="~/images/" oncheckedchanged="DNNMultiStateBox1_CheckedChanged" SelectedStateKey='<%# Eval("SelectedState") %>'>
<states>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="deny.gif" Key="Null" Text="Denied">
</DNN:DNNMultiState>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="unchecked.gif" Key="Unchecked" Text="UnChecked">
</DNN:DNNMultiState>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="grant.gif" Key="Checked" Text="Checked">
</DNN:DNNMultiState>
</states>
</DNN:DNNMultiStateBox>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Checked='<%# Convert.ToBoolean(Eval("Enabled")) %>' oncheckedchanged="CheckBox1_CheckedChanged" Text="Test" />
<asp:Label ID="Label1" runat="server" Text='<%# Eval("SelectedState") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Button" />
<DNN:DNNMultiStateBox ID="THISISANEWID" runat="server" ImagePath="~/images/" oncheckedchanged="DNNMultiStateBox2_CheckedChanged" SelectedStateKey="Null" AutoPostBack="True">
<states>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="deny.gif" Key="Null" Text="Denied">
</DNN:DNNMultiState>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="unchecked.gif" Key="Unchecked" Text="UnChecked">
</DNN:DNNMultiState>
<DNN:DNNMultiState DisabledImageUrl="lock.gif" ImageUrl="grant.gif" Key="Checked" Text="Checked">
</DNN:DNNMultiState>
</states>
</DNN:DNNMultiStateBox>
MY CODE BEHIND - Important Parts
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("SelectedState");
ds.Tables[0].Columns.Add("Enabled");
ds.Tables[0].Rows.Add(new object[] { "Null", "True" });
ds.Tables[0].Rows.Add(new object[] { "Checked", "True" });
ds.Tables[0].Rows.Add(new object[] { "Unchecked", "True" });
ds.Tables[0].Rows.Add(new object[] { "Null", "False" });
DataList1.DataSource = ds;
DataList1.DataBind();
}
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException(this, ex);
}
}
protected void DNNMultiStateBox1_CheckedChanged(object sender, EventArgs e)
{
DNNMultiStateBox msb = (DNNMultiStateBox) sender;
lblDebug.Text += "<BR>" + msb.ID + " -- " + msb.SelectedState.Key;
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox) sender;
lblDebug.Text += "<BR>" + chk.ID + chk.Checked;
}
protected void DNNMultiStateBox2_CheckedChanged(object sender, EventArgs e)
{
DNNMultiStateBox msb = (DNNMultiStateBox)sender;
lblDebug.Text += "<BR>" + msb.ID + " -- " + msb.SelectedState.Key;
}
I'm thinking I may have set up the control/dll wrong in my project. I have my project and build it outside of the DNN solution.
To get the DNNMSB control into my module I made a new tab, and went into "Choose Items..." selected the DotNetNuke.WebControls.dll then got back to my ASCX at which point I added the DNNMultiStateBox to my form.
The control loads and seems to operate except for the above mentioned things.
Any help on either, figuring out what I did wrong, or confirming there are issues would be great. :)
Thanks