I have code for an asp.net link button
I want to use it in a rad menu that I created when the user clicks on its menu item
i want client side code to run for the CopyClipboardMenuItem and PrintLabelMenuItem
The code works when I use a linkbutton
Is there a way to do this I have not found a solution that works. Thanks in advance for any help.
<
asp:LinkButton
ID
=
"LinkButton4"
runat
=
"server"
Text
=
"Copy To Clipboard"
OnCommand
=
"LinkButton4_Command"
OnClientClick
=
"CopyToClipboard();"
></
asp:LinkButton
>
<
telerik:RadMenu
runat
=
"server"
ID
=
"AssociateMenu"
Skin
=
"Windows7"
Width
=
"200px"
Flow
=
"Vertical"
EnableAutoScroll
=
"False"
>
<
Items
>
<
telerik:RadMenuItem
ID
=
"AddAssociateMenuItem"
runat
=
"server"
Text
=
"Add Associate"
NavigateUrl
=
"~/Add_Associate.aspx"
/>
<
telerik:RadMenuItem
ID
=
"ManageUserMenuItem"
runat
=
"server"
Text
=
"Manage User Account"
NavigateUrl
=
"~/Create_User.aspx"
/>
<
telerik:RadMenuItem
ID
=
"DeactivateAssociateMenuItem"
runat
=
"server"
Text
=
"Deactivate Associate"
NavigateUrl
=
"~/Deactivate_Associate.aspx"
/>
<
telerik:RadMenuItem
ID
=
"CopyClipboardMenuItem"
runat
=
"server"
Text
=
"Copy To Clipboard"
PostBack
=
"False"
/>
<
telerik:RadMenuItem
ID
=
"PrintLabelMenuItem"
runat
=
"server"
Text
=
"Print Mailing Label"
PostBack
=
"False"
/>
</
Items
>
</
telerik:RadMenu
>
i want client side code to run for the CopyClipboardMenuItem and PrintLabelMenuItem
function
CopyToClipboard() {
//RadPageView pv = (RadPageView)this.FindControl("RadPageView1");
//UserControl uc = (UserControl)pv.FindControl("UserControl1");
var
textboxVal = $get(
"<%= txtCopy.ClientID%>"
).value;
//var textboxVal = ((TextBox)pc.FindControl("txtCopy")).Text.Trim();
// var textboxVal = document.getElementById("txtCopy").value;
if
(window.clipboardData && clipboardData.setData) {
clipboardData.setData(
"Text"
, textboxVal);
alert(
"item successfully copy to Clipboard"
);
}
else
{
alert(
"works only in IE4+"
);
}
}
function
printLabel() {
// alert('test4');
// jQuery.lightbox({ href: "#dialog3" });
jQuery.colorbox({ innerWidth:
"390"
, innerHeight:
"210"
, opacity: .85, inline:
true
, overlayClose:
false
, transition:
"fade"
, speed: 1500, href:
"#dialog3"
});
}
The code works when I use a linkbutton
<
asp:LinkButton
ID
=
"LinkButton4"
runat
=
"server"
Text
=
"Copy To Clipboard"
OnCommand
=
"LinkButton4_Command"
OnClientClick
=
"CopyToClipboard();"
></
asp:LinkButton
>
</
br
>
<
asp:LinkButton
ID
=
"LinkButton2"
runat
=
"server"
Text
=
"Print Mailing Label"
OnCommand
=
"LinkButton2_Command"
OnClientClick
=
"printLabel(); return false;"
AutoPostBack
=
"false"
></
asp:LinkButton
>
Is there a way to do this I have not found a solution that works. Thanks in advance for any help.