CheckBoxes in ASP.Net 2.0 Menu Control

Last post 11-08-2005 11:37 AM by dannychen. 5 replies.

Sort Posts:

  • CheckBoxes in ASP.Net 2.0 Menu Control

    10-19-2005, 9:03 AM
    • Member
      65 point Member
    • dvm_2k1
    • Member since 07-14-2005, 4:23 AM
    • India
    • Posts 13
    Hi,

    We want to have a checkboxes onto the ASP.Net 2.0 Menu Controls. According to the information available from MSDN we could able to have a static menu items which can be bounded to SiteMap or DataSource controls. Please kindly help us in order to solve this problem.

    Thanks
    VDeevi.
    Thanks & Regards,
    VDeevi
  • Re: CheckBoxes in ASP.Net 2.0 Menu Control

    10-19-2005, 1:13 PM
    • Contributor
      4,347 point Contributor
    • dannychen
    • Member since 08-24-2004, 8:17 AM
    • Redmond, WA
    • Posts 840
    • AspNetTeam
      Moderator

    VDeevi,
      What would you like the checkboxes for?  You can certainly easily add checkboxes to your menu through templating for example:

    <asp:Menu ... >
    <StaticItemTemplate>
    <asp:CheckBox runat="server" id="CheckBox1" Text='<%# Eval("Text") %>' />
    </StaticItemTemplate>
    </asp:Menu>

    (this is much easier to do in DesignView, click EditTemplates from the chrome menu, drag and drop your checkbox and then use the edit databindings menu)

    But a TreeView natively supports CheckBoxes and since both controls are very similar, perhaps it can do the job for you? 
    --
    Danny

    disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
  • Re: CheckBoxes in ASP.Net 2.0 Menu Control

    11-07-2005, 4:27 AM
    • Member
      65 point Member
    • dvm_2k1
    • Member since 07-14-2005, 4:23 AM
    • India
    • Posts 13

    Hi Danny,

    We want to write a custom MenuItem control in ASP.Net 2.0. When we saw this URL in MSDN2 site we could able to see that the MenuItem class is a sealed class (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitem.aspx). Is there any mechanism that we can extend this class in order to develop a new custom MenuItem control which can be recognised by the Menu control of ASP.Net 2.0.

    Please kindly provide us some solution in order to solve this issue.

    Thanks
    VDeevi.

    Thanks & Regards,
    VDeevi
  • Re: CheckBoxes in ASP.Net 2.0 Menu Control

    11-07-2005, 2:22 PM
    • Contributor
      4,347 point Contributor
    • dannychen
    • Member since 08-24-2004, 8:17 AM
    • Redmond, WA
    • Posts 840
    • AspNetTeam
      Moderator
    I just recently got an email with this same question.  Here is my response.

      You should be able to handle this with templating.  What kinds of issues did you run into?  Here is a sample I put together which I was able to capture the checking events.  Let me know if this works for you.
    --
    Danny Chen
     
            <asp:Menu ID="Menu1" runat="server">
                <DynamicItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
                        Text='<%# Eval("Text") %>' />
                </DynamicItemTemplate>
                <StaticItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
                        Text='<%# Eval("Text") %>' />
                </StaticItemTemplate>
            </asp:Menu>
    disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
  • Re: CheckBoxes in ASP.Net 2.0 Menu Control

    11-08-2005, 3:41 AM
    • Member
      65 point Member
    • dvm_2k1
    • Member since 07-14-2005, 4:23 AM
    • India
    • Posts 13
    Thanks Danny, code which was given in your note has worked for me. But my question is, can we able to write a custom MenuItem control? If it is please provide us some information in order to start developing our own custom MenuItem controls which can be assigned to <asp:Menu> control usint <Items> element.

    Thanks
    Thanks & Regards,
    VDeevi
  • Re: CheckBoxes in ASP.Net 2.0 Menu Control

    11-08-2005, 11:37 AM
    • Contributor
      4,347 point Contributor
    • dannychen
    • Member since 08-24-2004, 8:17 AM
    • Redmond, WA
    • Posts 840
    • AspNetTeam
      Moderator
    No, as you noted, the MenuItem class is sealed and cannot be inherited.
    --
    Danny
    disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
Page 1 of 1 (6 items)