private void CreateToolTip()
{
GridDataItem DataItem;
int iPageIndex = rgSNLoc.CurrentPageIndex;
int iPageSize = rgSNLoc.MasterTableView.PageSize;
int iFactor = iPageIndex * iPageSize;
for (int i = iFactor; i < rgSNLoc.MasterTableView.Items.Count + iFactor; i++)
{
DataItem = rgSNLoc.MasterTableView.Items[i - iFactor] as GridDataItem;
if (sMultiAddr[i].Length == 1)
{
DataItem["loc_name"].ToolTip = sMultiAddr[i][0];
}
else
{
for (int j = 0; j < sMultiAddr[i].Length; j++)
{
if (j == sMultiAddr[i].Length - 1)
DataItem["loc_name"].ToolTip = sMultiAddr[i][j];
else
DataItem["loc_name"].ToolTip = sMultiAddr[i][j] + "\n\n";
}
}
}
}
I wrote the above function and put it in the "PreRender" event handler of the RadGrid. What I want to do is to assign a unique tooltip to each row of a specified column in the grid, and the tooltip will still exist correctly even the user change the page size or switch to another page of the grid dynamically. However, if the user sort on a column, the value of the tooltips will become wrong. So how can I keep the tooltips correctly in this case? Thanks.
I have found an issue trying to change the content of a RadDock after the dock has been moved. Specifically, I can change the content with server-side code prior to moving the RadDock around on the page...after I move it, I get the following error:
Sys.InvalidOperationException: Two components with the same id 'RadDock1' can't be added to the application.
Here's the code for a very simple example is below. One RadDock and buttons.
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">
<telerik:RadDock ID="RadDock1" runat="server" Width="300px">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</telerik:RadDock>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</telerik:RadAjaxPanel>
Clicking the button changes the text of the label inside the RadDock:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
label1.text =
"1"
End Sub
To demonstrate the bug: Load the page, click the button. The text inside the RadDock changes correctly. Now drag the RadDock to somewhere else on the page and click the button again. The JavaScript error listed above occurs.
Is this not correct use of this control? Is there something I'm missing?
Thanks,
david
<telerik:RadSpell ID="RadSpell1" Runat="server" ButtonType="LinkButton"
ControlToCheck="txtBox" Language="fr-FR" SupportedLanguages="fr-FR" DictionaryPath="~/App_Data/RadSpell/" CssClass="footertext" Skin="WebBlue" />

| Protected Sub RadToolTipManager2_AjaxUpdate(ByVal sender As Object, ByVal e As ToolTipUpdateEventArgs) |
| Dim aptId As IntegerInteger = Integer.Parse(e.TargetControlID.Split("_"C)(1)) |
| Dim apt As Appointment = RadScheduler1.Appointments(aptId) |
| Dim toolTip As AppointmentToolTip = DirectCast(LoadControl("AppointmentToolTip.ascx"), AppointmentToolTip) |
| toolTip.TargetAppointment = apt |
| e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTip) |
| End Sub |
<telerik:RadTabStrip Skin = "Sunset" MultiPageID="RadMultiPage1" ID="RadTabStrip1" runat="server">
<Tabs>
<telerik:RadTab Text="General">
</telerik:RadTab>
<telerik:RadTab Text="Tools">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPage1" runat="server">
<telerik:RadPageView ID = "RadPageView1" runat = "server" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="width:100%;">
<tr><td>Test 1</td><td> </td><td> </td></tr>
<tr><td colspan="3">
<telerik:RadGrid OnSortCommand="RadGrid1_SortCommand" AllowSorting="True"
AllowPaging = "true" PageSize = "5" AutoGenerateColumns = "False" ID="RadGrid1" runat="server"
Skin="Sunset" Width="275px" onneeddatasource="RadGrid1_NeedDataSource">
<MasterTableView DataKeyNames="customer_id" >
<Columns>
<telerik:GridBoundColumn DataField="customer_id" HeaderText="QA Number" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="customer_name" SortExpression = "customer_name" HeaderText="Can Reply" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<PagerStyle Mode="Slider"></PagerStyle>
</telerik:RadGrid>
</td></tr>
<tr><td> </td><td> </td><td> </td></tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</telerik:RadPageView>
<telerik:RadPageView ID="RadPageView2" runat="server">
<table style="width:100%;">
<tr><td>Test 2</td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
</table>
</telerik:RadPageView>
</telerik:RadMultiPage>
ASPX.CSprotected void Page_Load(object sender, EventArgs e)
{
List<gen_customer> customers = (from c in db.gen_customers
where c.customer_id < 103
select c).ToList<gen_customer>();
RadGrid1.DataSource = customers;
RadGrid1.DataBind();
}
protected void RadGrid1_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e)
{
if (!e.Item.OwnerTableView.SortExpressions.ContainsExpression(e.SortExpression))
{
GridSortExpression sortExpr = new GridSortExpression();
sortExpr.FieldName = e.SortExpression;
sortExpr.SortOrder =
GridSortOrder.Ascending;
e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr);
}
}
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
List<gen_customer> customers = (from c in db.gen_customers
where c.customer_id < 103
select c).ToList<gen_customer>();
RadGrid1.DataSource = customers;
}