Welcome Guest Search | Active Topics | Sign In | Register

Adding checkbox control to the MenuItem section Options
hunpirate
Posted: Monday, December 14, 2015 4:46:47 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Hi,

I have a slide menu control that I would like to enhance. I use the control to display note items my users entered into our system. The head part of the menu item displays the note information (ex: Entered by XXXX on 09/29/2014 09:38:10). The droppable part of the item displays the actual note.

I been requested to find out if we could add an asp chexbox on each header info to able to tag a note (on or off). It should trigger on click and write into our db to that particular record.

I was wondering if this is even possible. I already tried just to add the checkbox item to my header html text, but it doesn't work.

objNewMenu.Text.Html += "&nbsp;&nbsp;<asp:CheckBox ID='cbxVisit" & ViewState("menuindex") & "' runat='server' />"

Any suggestion?

Below is my EO object I build dynamically, by adding menu items from a database record set.

<eo:slidemenu id="smACNotesViewer" runat="server" Width="510px" SlidePaneHeight="25" ControlSkinID="None">
<TopGroup Orientation="Vertical">
<Items>
<eo:menuitem Text-Html="Test Note Header">
<SubMenu>
<Items>
<eo:menuitem Text-Html="Test Note" />
</Items>
</SubMenu>
</eo:menuitem>
</Items>
</TopGroup>
<LookItems>
<eo:menuitem ItemID="_TopGroup">
<SubMenu Style-CssText="font-size: 8pt; cursor: hand; color: #8da1ad; border-top-style: none; font-family: Verdana; border-right-style: none; border-left-style: none; border-bottom-style: none;"
ItemSpacing="1"></SubMenu>
</eo:menuitem>
<eo:menuitem HoverStyle-CssText="background-color:#ffffbd;border-bottom-color:#9c9a9c;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#9c9a9c;border-left-style:solid;border-left-width:1px;border-right-color:#9c9a9c;border-right-style:solid;border-right-width:1px;border-top-color:#9c9a9c;border-top-style:solid;border-top-width:1px;color:black;font-family:Verdana, Arial, Tahoma, Sans-Serif;font-size:8pt;font-weight:bold;padding-bottom:2px;padding-left:0px;padding-right:2px;padding-top:2px;"
ItemID="_TopLevelItem" NormalStyle-CssText="background-color:#E7E7E7;border-bottom-color:#9c9a9c;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#9c9a9c;border-left-style:solid;border-left-width:1px;border-right-color:#9c9a9c;border-right-style:solid;border-right-width:1px;border-top-color:#9c9a9c;border-top-style:solid;border-top-width:1px;color:#8da1ad;font-weight:bold;padding-bottom:2px;padding-left:0px;padding-right:2px;padding-top:2px;"
SelectedStyle-CssText="background-color:#a5c3e7;border-bottom-color:#010918;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#010918;border-left-style:solid;border-left-width:1px;border-right-color:#010918;border-right-style:solid;border-right-width:1px;border-top-color:#010918;border-top-style:solid;border-top-width:1px;color:#010918;font-family:Verdana, Arial, Tahoma, Sans-Serif;font-size:8pt;font-weight:bold;padding-bottom:2px;padding-left:0px;padding-right:2px;padding-top:2px;">
<SubMenu Style-CssText="background-color:#F5F5F5;border-bottom-color:#9c9a9c;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#9c9a9c;border-left-style:solid;border-left-width:1px;border-right-color:#9c9a9c;border-right-style:solid;border-right-width:1px;color:#8da1ad;cursor:default;font-family:Verdana;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:0px;padding-top:4px;"
LeftIconCellWidth="2" ItemSpacing="1"></SubMenu>
</eo:menuitem>
<eo:menuitem DisabledStyle-CssText="font-weight: normal; font-size: 12px; color: black; line-height: 1.25em; font-family: arial, verdana, tahoma, helvetica, sans-serif;"
Height="15" ItemID="_Default">
<SubMenu Style-CssText="background-color:transparent;border-bottom-color:#9c9a9c;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#9c9a9c;border-left-style:solid;border-left-width:1px;border-right-color:#9c9a9c;border-right-style:solid;border-right-width:1px;border-top-color:#9c9a9c;border-top-style:solid;border-top-width:1px;color:#8da1ad;cursor:hand;font-family:Verdana;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;"
OffsetX="2" ItemSpacing="1"></SubMenu>
</eo:menuitem>
</LookItems>
</eo:slidemenu>



Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
eo_support
Posted: Wednesday, December 16, 2015 10:11:01 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You will not be able to put ASP.NET server control into MenuItem.Text.Html. That property only accepts raw HTML code. So for example, you can set it to "<input type='checkbox' />" and that will render correctly.

In order to raise an event when the checkbox is clicked, you must use JavaScript. If you must raises server event, then you can use ScriptEvent control. See here on how to use this control:

http://www.essentialobjects.com/doc/eo.web.scriptevent.aspx

So you will need to format such JavaScript in the HTML code for item HTML. For example:

MenuItem.Text.Html =
"<input type=\"checkbox\" onclick=\"eo_TriggerServerEvent('ScriptEvent1', 'command_name', 'command_argument');\" >"

You will need to change 'command_name' and 'command_argument' to values that you can use to identify which checkbox has been clicked.

Thanks!
hunpirate
Posted: Thursday, December 17, 2015 10:43:33 AM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Thank you so much


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
hunpirate
Posted: Thursday, December 17, 2015 12:32:10 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Hi,

Sorry to come back to you again, but I'm still having trouble this time to raise the onclick event from the embedded checkbox on the server side.

The server side creates the embedded checkbox:
objNewMenu.Text.Html = "<input type='checkbox' onclick=eo_TriggerServerEvent('sevVisited', 'UPDATE', '" & strNoteID & "'); />"

The html side has the ScriptEvent conrol:
<eo:ScriptEvent ID="sevVisited" runat="server" />

...and finally on the servers side I try to capture the "command" event when the checkbox gets clicked:
Private Sub sevVisited_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles sevVisited.Command

Stop

End Sub

The event does not fire on the server side. Any advise why?


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
hunpirate
Posted: Thursday, December 17, 2015 1:55:45 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Hi,

I figured the one above out. It was about how the event call was assembled missing some quotes:
"<input type='checkbox' onclick=" & Chr(34) & "eo_TriggerServerEvent('sevVisited', 'UPDATE', '" & strNoteID & "');" & Chr(34) & " />"

...but now I have trouble to catch the checkbox "checked" status. The "sender" in the event refers to the ScriptEvent object, the "CommandEventArgs" only have the passed in values "'command_name" and "command_argument".

How can I get the proper checked status of the caller checkbox that called the event?


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
eo_support
Posted: Thursday, December 17, 2015 8:34:04 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You need to seek other resource for your last question. What we provide is the ScriptEvent control for you to trigger a server event. How to collect what data you need to pass to the server in your JavaScript code is considered generic Web programming question thus beyond the scope of our support.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.