Hi Telerik support,
I am running Telerik: v2008.3.1214.35
I am having trouble with the radgrid and tooltipManager with paging.
The grid is dynamically loaded when a menu selection is made.
When I don’t have paging my tooltips behave properly. With paging they are display data from the first page only.
I have the tooltip and the grid defined in AJAX manager, because I am using paging I went from simple databinding to advanced. I know there is a sequence to the databinding when using advanced.
I know I am hitting the Itemdatabound event before the rebind… Could you please provide an example on how to resolve this.
Thank you
Julie
Code below:
The setting in Ajax manager.
<telerik:AjaxSetting AjaxControlID="gridStudyDetails">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="gridStudyDetails" LoadingPanelID="LoadingPanel1"/>
<telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server"
RelativeTo="Element"
Width="420px"
Height="150px"
Position="BottomLeft"
HideEvent="ManualClose"
Title="Study Details"
Skin="Vista"
Animation="Slide"
ShowEvent="OnClick" AutoTooltipify="False"
onajaxupdate="RadToolTipManager1_AjaxUpdate" EnableViewState="True">
</telerik:RadToolTipManager>
The grid
<telerik:RadGrid ID="gridStudyDetails" runat="server" AutoGenerateColumns="False"
ClientSettings-Selecting-AllowRowSelect="true" CssClass="gridText"
skin="Vista" Width="675px" GridLines="None"
onitemcommand="gridStudyDetails_ItemCommand" AllowSorting="True"
onsortcommand="gridStudyDetails_SortCommand"
onitemdatabound="gridStudyDetails_ItemDataBound" AllowPaging="True"
onpageindexchanged="gridStudyDetails_PageIndexChanged" PageSize="6"
EnableViewState="False" onneeddatasource="gridStudyDetails_NeedDataSource" >
<HeaderContextMenu EnableTheming="True">
<CollapseAnimation Duration="200" Type="OutQuint" />
</HeaderContextMenu>
<ValidationSettings EnableValidation="False" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ClientSettings enablepostbackonrowclick="True">
<Selecting AllowRowSelect="True" />
</ClientSettings><FilterMenu EnableTheming="True">
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
<PagerStyle Position="TopAndBottom" EnableSEOPaging="True" />
<MasterTableView DataKeyNames="StudyID, ProtocolID" EnableViewState="True" CurrentResetPageIndexAction="SetPageIndexToFirst">
<Columns>
<telerik:GridBoundColumn DataField="StudyID" HeaderText="Study ID" UniqueName="StudyID" Visible="True" ReadOnly="true">
<HeaderStyle Width="65px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RecType" HeaderText="RecType UniqueName="RecType" Visible="False" ReadOnly="true">
<HeaderStyle Width="65px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="DetailStudy">
<ItemTemplate>
<asp:HyperLink ID="hlkStudyDetail" runat="server" NavigateUrl="#" Text="Details" ></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Code Behind:
protected void gridStudyDetails_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
Control hpStudyDetail = e.Item.FindControl("hlkStudyDetail");
if (!Object.Equals(hpStudyDetail, null))
{
if (!Object.Equals(this.RadToolTipManager1, null))
{
DataRowView currentRow = (DataRowView)e.Item.DataItem;
this.RadToolTipManager1.TargetControls.Add(hpStudyDetail.ClientID,currentRow.Row["StudyID"].ToString(), true);
}
}
}
}
protected void gridStudyDetails_PageIndexChanged(object source, GridPageChangedEventArgs e)
{
gridStudyDetails.DataSource = null;
RadToolTipManager1.TargetControls.Clear();
gridStudyDetails.Rebind();
}
protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
{
Control ctrl = Page.LoadControl("StudyDetail.ascx");
StudyDetail details = (StudyDetail)ctrl;
details.StrStudyID = e.Value;
e.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl);
}
protected void gridStudyDetails_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
if (Session["Selection"] != null)
{
string selection = Session["Selection"].ToString();
if (selection == "Pending" || selection == "Approved" || selection == "Archived")
{
SetMenu(selection);
}
else
{
gridStudyDetails.DataSource = null;
}
}
}
protected void SetMenu(string selection)
{
switch (selection)
{
case "Pending":
{
lblGridHeader.Text = "Pending Studies";
lblGridDetails.Text = "Studies";
gridStudyDetails.Columns.FindByUniqueName("ApprovalToDate").Display = false;
gridStudyDetails.Columns.FindByUniqueName("ReceiveDate").Display = true;
DataColumn dc0 = new DataColumn("DashBoardSelection");
dc0.DataType = typeof(string);
dc0.DefaultValue = selection;
gridDataTable.Columns.Add(dc0);
DataColumn dc1 = new DataColumn("DashBoardCategory");
dc1.DataType = typeof(string);
dc1.DefaultValue = "Studies";
gridDataTable.Columns.Add(dc1);
gridStudyDetails.DataSource = gridDataTable;
//gridStudyDetails.DataBind();
StudyPanel.CssClass = "";
break;
}
}
}
protected void MenuDashboard_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
{
Session["Selection"] = e.Item.Value;
if (e.Item.Value == "Pending" || e.Item.Value == "Approved" || e.Item.Value == "Archived")
{
gridStudyDetails.DataSource = null;
gridStudyDetails.Rebind();
}
else
{
SetMenu(e.Item.Value);
}
}