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

[Solved] access RadToolTip control from aspx page

4 Answers 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
kachy
Top achievements
Rank 1
kachy asked on 15 Jun 2008, 02:32 AM
http://www.telerik.com/DEMOS/ASPNET/Prometheus/ToolTip/Examples/LoadOnDemand/DefaultCS.aspx

I am using this example and have a checkboxlist in the tooltip . Is there a way I can access the value of the checkboxlist from my main aspx file? I have to save that checkbox value with AJAX without using any submit button in the tooltip ascx page.

Please help.

Thanks,
KM

4 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 16 Jun 2008, 02:06 PM
Hello kachy100,

Yes, it is possible to access the RadToolTip's content elements and you can do this in the standard way, by using the getElementById function.

Let's assume that you have a RadToolTip with a checkbox list in it and its ManualClose property set to true. After the user has made his selection, he closes the tooltip and you need to extract which items are selected.

In order to achieve this you should hook up the OnClientClose event of RadToolTip, access the checkboxlist and check its items' status. You can achieve this by using the following code:


ASPX:

 <script type="text/javascript">  
        function ClientHide(sender, args)  
        {  
           var j=0;  
           var chk=document.getElementById('check');   
           alert(chk);  
           for(i=0;i<chk.rows.length;i++)  
          {  
             var chklist=document.getElementById('check_' + i );   
             alert("item" + (i+1) + " - checked:" + chklist.checked);   
           }  
        }  
        </script> 
                    <asp:Button ID="Button1" runat="server" Text="ToolTip" /> 
                     <telerik:RadToolTip ID="RadToolTip1" runat="server" ManualClose=true OnClientHide="ClientHide" TargetControlID="Button1" RelativeTo="BrowserWindow" 
                    Position="Center" Width="200" Height="200">  
                    <asp:CheckBoxList ID="check" runat=server>  
                    <asp:ListItem Text="first">  
                    </asp:ListItem> 
                    <asp:ListItem Text="second">  
                    </asp:ListItem> 
                    <asp:ListItem Text="third">  
                    </asp:ListItem> 
                    </asp:CheckBoxList> 
                </telerik:RadToolTip> 
            



Kind regards,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
kachy
Top achievements
Rank 1
answered on 16 Jun 2008, 04:49 PM
Thanks for your reply, it helped.
I was using RadToolTipManager with ascx file for the tooltip previously.
Now I am using the tooltip the way you have suggested.
Can you please guide with some example, how can I refresh the page with AJAX onmouseout event of the tooltip? I want to access that checkbox in the tooltip and refresh the datagrid in the main page with whatever new columns have been selected.

Thanks,
Kachy100
0
kachy
Top achievements
Rank 1
answered on 17 Jun 2008, 03:54 AM

I am new to AJAX and would like to know, onmouseout of the tooltip, how can I refresh the datagrid? I tried AjaxPanel and AjaxMAnager both but I get error "Object does not supprt this property or method"

protected

void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

{

if (e.Argument == "Rebind")

{

RadGrid1.MasterTableView.SortExpressions.Clear();

RadGrid1.MasterTableView.GroupByExpressions.Clear();

RadGrid1.Rebind();

}

else if (e.Argument == "RebindAndNavigate")

{

RadGrid1.MasterTableView.SortExpressions.Clear();

RadGrid1.MasterTableView.GroupByExpressions.Clear();

RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;

RadGrid1.Rebind();

}

else if (e.Argument == "Refresh")

{

string qry = "";

qry =

"select top 15 " + Session["selectedcolumn"].ToString() + "," + Session["unselectedcolumn"].ToString() + " FROM table";

SqlDataSource2.SelectCommand = qry;

RadGrid1.DataBind();

}

}


<

script type="text/javascript">

 

 

function

ClientHide(sender, args)

{

var pnl = <%= RadAjaxManager1.ClientID %>;

//alert("hi");

 

pnl.AjaxRequest(

'<%= RadAjaxManager1.UniqueID %>','Refresh');

}

</script>


<

asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">

</telerik:RadAjaxManager>

<div>

&nbsp;

<telerik:RadToolTip ID="RadToolTip1" runat="server" ManualClose=false OnClientHide="ClientHide" TargetControlID="Hyperlink1" RelativeTo="BrowserWindow"

Position="Center" Width="200" Height="200">

<asp:CheckBoxList ID="check" runat=server>

</asp:CheckBoxList>

</telerik:RadToolTip>

<asp:HyperLink ID="HyperLink1" runat="server">Show/Hide</asp:HyperLink>

Please help.

Thanks

0
Yavor
Telerik team
answered on 17 Jun 2008, 06:46 AM
Hi,

In order to make sure that you are able to refresh the other controls via an AjaxRequest, please set the appropriate settings for the manager (update initiators, as well as updated controls). Additional information is available in the following article.
I hope this information helps.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
kachy
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
kachy
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or