|
Rank: Advanced Member Groups: Member
Joined: 7/6/2011 Posts: 30
|
I want to simply to close a flyout on the client side from a button within the flyout. What is the best way to go about it please?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can use the following code to close a flyout:
Code: JavaScript
//Get the client side Flyout object
var flyout = eo_GetObject("<%=Flyout1.ClientID%>");
//Close the flyout
flyout.hide();
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/6/2011 Posts: 30
|
Great, thank you!
|
|
Rank: Advanced Member Groups: Member
Joined: 7/6/2011 Posts: 30
|
Ah - now I'm getting the error "The name 'Flyout1' does not exist in the current context" - I have the flyout inside a repeater. Any thoughts on how I should reference the object would be much appreciated.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can do something like this:
Code: HTML/ASPX
<asp:Repeater runat="server" ID="rpt1">
<ItemTemplate>
<asp:Button runat="server" ID="Button1" Text="Button1" />
<eo:Flyout runat="server" ID="Flyout1" For="Button1">
<ContentTemplate>
<div onclick='hideFlyout("<%#GetFlyoutID(Container)%>")';>
test 1
</div>
</ContentTemplate>
</eo:Flyout>
</ItemTemplate>
</asp:Repeater>
hideFlyout is a JavaScript function:
Code: JavaScript
function hideFlyout(flyoutId)
{
//Get the client side Flyout control
var flyout = eo_GetObject(flyoutId);
//Hide the flyout
flyout.hide();
}
GetFlyoutID is a code behind function:
Code: C#
protected string GetFlyoutID(object container)
{
//Cast the container into a RepeaterItem. Note this only
//works for a repeater. If your control is not a Repeater,
//then you will need to change the type here accordingly
RepeaterItem item = (RepeaterItem)container;
//Find the flyout control and returns its ClientID
return item.FindControl("Flyout1").ClientID;
}
Hope this helps. Please feel free to let us know if you have any more questions. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 7/6/2011 Posts: 30
|
YES! It works, thank you so much.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Great. Please feel free to let us know if you have any more questions.
Thanks!
|
|