Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIDNNMultiStateBox - Problems UsingDNNMultiStateBox - Problems Using
Previous
 
Next
New Post
11/25/2008 5:34 AM
 

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
 

 

 
New Post
11/25/2008 9:00 AM
 

Thanks for your feedback.  The gemini support page for webcontrols is here.

The control was written to allow for the logic to be toggled on the client-side.  Having a checkbox continually do postbacks is far from an optimal user experience (I am not a fan of updatepanels as you probably already know from my blog).  The reason the control has a lot of the properties/events that you are having trouble with is I inherited it from checkbox.  Doing this has some positives like allowing it to be easily inserted into the existing dnn property grid, but also some negatives as you have been confused that the server-side postback properties and events do not work. 

At this point I have two options. 

1)  Hide the server-side postback properties from the end-user as they were only added due to inheriting from checkbox.

2)  Spend time making them work even though I see little reason to do so

I am leaning towards option 1.  If you could provide me a compelling reason to spend time on option 2 I may change my mind

Thanks again.


 
New Post
12/18/2012 10:29 AM
 
I know this is an old thread, but I haven't seen any other that touch on this subject.

I am using this control, and I also need the PostBack feature to work. I am including this control in a custom RADGrid I created. This control represents a "Locked" flag on each record. I want the user to be able to toggle this "Locked" flag on and off. However, since there is no PostBack feature available, I can't update the associated record.

Is there a way I can tie in a PostBack event using AddHandler or something?

Please help!

-Ben

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIDNNMultiStateBox - Problems UsingDNNMultiStateBox - Problems Using


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out