This is a migrated thread and some comments may be shown as answers.

How to clos radTooltip automatically after clicking a button which is ther on tootip ?

3 Answers 289 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 02 Mar 2009, 06:37 AM
Hi,

I am showing a radtooltip(which is having some controls and a save button) onclik of a image button which is in radGrid,

Now my question is I want to close the tooltip automatically after clicking on save button and at the same time, the radGrid shold be refreshed ?
my tooltip decleration is as follows

 

<telerik:GridTemplateColumn HeaderText="Status" UniqueName="TemplateColumn">

 

 

 

<ItemTemplate>

 

 

 

 

<asp:ImageButton ID="Img" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "Image") %>' />

 

 

 

<telerik:RadToolTip ID="RadToolTip1" runat="server" Height="200px" Width="500px"

 

 

 

TargetControlID="Img" ManualClose="True" Position="TopRight" ShowCallout="False"

 

 

 

Skin="Gray">

 

 

 

<div id="NessCheck" runat="server">

 

 

 

<asp:Image ID="Imagt" runat="server" ImageUrl="~/images/screen.gif" />

 

 

 

<asp:Label ID="lblOld" Text="( Old Screen Shot )" runat="server" />

 

 

 

<asp:LinkButton ID="lDetails" Text="View Detail" runat="server" />

 

 

 

<br />

 

 

 

<br />

 

 

 

<asp:Label ID="lblDocument" Text="Do you want to attach ?" runat="server" />

 

 

 

&nbsp

 

 

 

<input type="radio" id="rbYes" value="Yes" name="screenshot"

 

 

 

runat="server" />

 

 

 

&nbsp

 

 

 

<input type="radio" id="rbNo" value="No" name="screenshot" runat="server" />

 

 

 

</div>

 

 

 

<div id="CheckT" runat="server" style="display: none">

 

 

 

<asp:Label ID="lblVerification" Text=" Verification:" runat="server" />

 

 

 

<asp:TextBox ID="txtScreen" runat="server" />

 

 

 

&nbsp;

 

 

 

<asp:Button ID="btnBrowse" Text="Browse..." runat="server" />

 

 

 

</div>

 

 

 

<asp:Button ID="btnSave" Text="Save" CommandName="SaveFile" CommandArgument=""

 

 

 

runat="server" />

 

 

 

&nbsp;&nbsp

 

 

 

<asp:Button ID="btnCancel" Text="Cancel" runat="server" />

 

 

 

</telerik:RadToolTip>

 

 

 

<telerik:RadToolTip ID="RadToolTip2" runat="server" Height="200px" Width="500px"

 

 

 

TargetControlID="Img" ManualClose="True" Position="TopRight" ShowCallout="False"

 

 

 

Skin="Gray">

 

 

 

<div id="screenshot1" runat="server" >

 

 

 

<asp:Label ID="lblAttachs" Text="verification "

 

 

 

runat="server" />

 

 

 

<asp:TextBox ID="txtScreen" runat="server" />

 

 

 

&nbsp;

 

 

 

<asp:Button ID="btnBrowse1" Text="Browse..." runat="server" />

 

 

 

<asp:Button ID="btnSave1" Text="Save" CommandName="SaveFile" runat="server" />

 

 

 

&nbsp;&nbsp

 

 

 

<asp:Button ID="btnCancel1" Text="Cancel" runat="server" />

 

 

 

</div>

 

 

 

</telerik:RadToolTip>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

How can I do this,

Thanks,

 

 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Mar 2009, 09:29 AM
Hi Ram,

Try the code below to hide the tooltip after clicking a button.

In the Item Command Event check for the "Command name "SaveFile" and add the folling line there.

protected void RadGrid1_ItemCommand( ....
{

if(e.CommandName ="SaveFile" )
{
 //Close the active ToolTip.
            ScriptManager.RegisterClientScriptBlock(
                this.Page,
                this.GetType(),
                "WebUserControlSript",
                "CloseActiveToolTip('" + this.ID + "')",
                true);

}

}
Add this jacascript in the aspx;

<script type="text/javascript">
    function CloseActiveToolTip(supplierID)
    {
        var controller = Telerik.Web.UI.RadToolTipController.getInstance();
        var tooltip = controller.get_activeToolTip();
        if (tooltip) tooltip.hide();
     }
    </script>


Go through the online demo showing how to insert items to the radgrid using the radtooltip.


Shinu.
0
Ram
Top achievements
Rank 1
answered on 04 Mar 2009, 10:56 AM

Hi,
Thanks for the reply, the code is workig.

But with this code I am able to close the tooltip only one time means afetr loading the grid first time, when I click a image button in image column of grid I am opening tooltip and on click of save button in tooltip, the tooltip is closing.
but when I do the same thing by clicking on other image button in grid I am getting following error:

Server Error in '/RadTooltip' Application.
--------------------------------------------------------------------------------

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


and one morething I forgot to mention that

How coulld I refresh the radGrid automatically after clicking on SAVE button ?

Thanks,

0
Svetlina Anati
Telerik team
answered on 05 Mar 2009, 09:01 AM
Hi Ram,

I am afraid I cannot say what is actually happening in your exact setup since I cannot analyze it on my side. Looking at the error message I can only suggest to try one of the following options:

  1. Use ClientScriptManager instead of ScriptManager to inject the script  from the server.
  2. Set <%@ Page EnableEventValidation="false" %> for this particular page.

If this does not help, you should prepare a sample, fully runnable demo (use Northwind or a fake datasource if needed), open a new support ticket and send it to me along with detailed reproduction steps and explanations.

As to the automatic update of the grid, it depends on your exact scenario - one option is to rebind the grid before closing the tooltip and another option is to use AJAX as shown in the demo below:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ToolTip
Asked by
Ram
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ram
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or