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
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
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
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>
<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
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