Sergey Sugak
Top achievements
Rank 1
Sergey Sugak
asked on 18 May 2010, 04:15 PM
Hello, guys.
I have menu item with template. There are several controls. Among them button.
How do I make this button to close menu item it's in and then process what is aasigned to it's server OnClick part?
Now what I experience is menu item stays on util I move mouse out of the content of the template.
With respect, Sergey.
I have menu item with template. There are several controls. Among them button.
How do I make this button to close menu item it's in and then process what is aasigned to it's server OnClick part?
Now what I experience is menu item stays on util I move mouse out of the content of the template.
With respect, Sergey.
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 19 May 2010, 02:41 PM
Hello,
If you want to close the RadMenuItem, then you can simply use the 'close()' method of corresponding radmenuitem client object.
In trhe case of achieving the same from code behind, you could invoke one client method from server using "ScriptManager.RegisterStartupScript" by passing the menuitem value. And in the client function access the menu item and use the close method to collapse the item.
Thanks,
Princy.
If you want to close the RadMenuItem, then you can simply use the 'close()' method of corresponding radmenuitem client object.
In trhe case of achieving the same from code behind, you could invoke one client method from server using "ScriptManager.RegisterStartupScript" by passing the menuitem value. And in the client function access the menu item and use the close method to collapse the item.
Thanks,
Princy.
0
Sergey Sugak
Top achievements
Rank 1
answered on 21 May 2010, 06:45 AM
"you could invoke one client method from server using "ScriptManager.RegisterStartupScript" by passing the menuitem value"
I'm not really javascript fan. So could you please give me a working code exapmle for this call?
Thanks in advance,
with respect, Sergey.
I'm not really javascript fan. So could you please give me a working code exapmle for this call?
Thanks in advance,
with respect, Sergey.
0
Hello Sergey,
Please check this blog post for more information about executing javascript from code-behind.
Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Please check this blog post for more information about executing javascript from code-behind.
Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sergey Sugak
Top achievements
Rank 1
answered on 21 May 2010, 02:30 PM
Hello again.
I didn't mean I don't know how to call this or those javascript function from codebihind. I meant that I would really appreciate if someone could show me the exact call of "the 'close()' method of corresponding radmenuitem client object" with "passing the menuitem value".
With respect, Sergey.
I didn't mean I don't know how to call this or those javascript function from codebihind. I meant that I would really appreciate if someone could show me the exact call of "the 'close()' method of corresponding radmenuitem client object" with "passing the menuitem value".
With respect, Sergey.
0
Accepted
Hi Sergey Sugak,
Here is a sample which shows how to use close() method:
and the closeItem function:
Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Here is a sample which shows how to use close() method:
<
telerik:RadMenu
ID
=
"RadMenu1"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"root item"
>
<
Items
>
<
telerik:RadMenuItem
Value
=
"tempButton"
>
<
ItemTemplate
>
<
asp:Button
ID
=
"button1"
Text
=
"click"
OnClientClick
=
'closeItem("tempButton")'
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadMenu
>
and the closeItem function:
<script type=
"text/javascript"
>
function
closeItem(val) {
alert(1);
var
menu = $find(
"<%=RadMenu1.ClientID %>"
);
menu.findItemByValue(val).get_parent().close();
return
false
;
}
</script>
Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sergey Sugak
Top achievements
Rank 1
answered on 27 May 2010, 11:00 AM
Thanks, Yana.
Now it's all clear.
With respect, Sergey.
Now it's all clear.
With respect, Sergey.