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

RadToolTip Paging

9 Answers 174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julie
Top achievements
Rank 1
Julie asked on 11 Jul 2009, 05:56 PM

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

            }

        }

9 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 15 Jul 2009, 02:35 PM
Hello Julie,

You need to clear the TargetControls collection of RadToolTipManager when paging or sorting operation occurs as illustrates on this online demo:

http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid

Thus the tooltips should be synchronized with the grid data when you switch between pages or sort the items in the grid.

Best regards,
Sebastian
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.
0
Julie
Top achievements
Rank 1
answered on 23 Jul 2009, 06:01 PM
Hi Telerik Support,
I have the following code in addition to the code listed in original post, this is the itemcommand  for the grid.... 

 

protected void gridStudyDetails_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

if (e.CommandName == "View" && e.Item is GridDataItem)

 

{

e.Item.Selected =

true;

 

 

// Confirm the templateID as an int...

 

 

int studyID;

 

 

Int32.TryParse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["StudyID"].ToString(), out studyID);

 

 

 

 

if (e.CommandName == "Page")

 

{

 

//gridStudyDetails.DataSource = null;

 

RadToolTipManager1.TargetControls.Clear();

 

//gridStudyDetails.Rebind();

 

}

 

}

The tooltip always refers to the first rendered page.  
Thanks for the help..
~Julie

0
Sebastian
Telerik team
answered on 24 Jul 2009, 07:55 AM

Hello Julie,

Can you please verify that the ItemCommand event of the grid is fired when switching between different pages and the code which clears the RadToolTipManager's TargetControls collection gets executed?

Additionally, I noticed that you set EnableViewState = false for the grid - check whether setting this property back to true makes a difference. Also keep in mind that the grid viewstate is required for operations like grouping, filtering, custom edit forms, etc.

Best regards,

Sebastian
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.
0
Julie
Top achievements
Rank 1
answered on 24 Jul 2009, 07:41 PM
Hi Support Team,
I have set EnableViewState = True.  The ItemCommand Event does Not fire....
I have the event declaration on the grid and in the code... See above...

~Julie
0
Sebastian
Telerik team
answered on 27 Jul 2009, 10:10 AM
Hello Julie,

I conclude you already followed all directions so far. At this point the best means to progress in our investigation is to prepare a stripped working version of your project, exhibiting the issue, and send it enclosed to a regular support ticket.  I will test/debug it locally and will get back to you with my findings.

Regards,
Sebastian
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.
0
Julie
Top achievements
Rank 1
answered on 29 Jul 2009, 08:22 AM
Hi Telerik Support,
Could you please provide an example utilizing advanced databinding, I believe this is the only difference between what the demo ( http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid)
has and what I have for my project.  I don't understand why the itemcommand event does not fire.  

Along with this how would you manage two dynamic grids on  the same page, with two different tooltips, would you have two tool tip managers on the page?

Thanks
Julie
0
Accepted
Sebastian
Telerik team
answered on 03 Aug 2009, 12:14 PM

Hello Julie,

For your convenience I prepared a modified version of the online demo in which the grid instance is bound to data using NeedDataSource event handling. You will find it attached to this forum thread. Feel free to use it as basis for your custom project schema.

Regarding your additional question:
If you plan to use the same approach with several grid instances on the page, you can either use a separate tooltip manager for each of them or define a single tooltip manager on the page and configure its tooltip settings programmatically on a per grid basis following the same concepts.

Regards,

Sebastian
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.
0
Julie
Top achievements
Rank 1
answered on 07 Aug 2009, 07:26 PM
Hi Telerik Support !!!
Thank you for your help Sebastian!!!!!!
Here is some additional information,
I went through the attached solution and the solution I had posted to the support ticket and found they both worked once the
OnSortCommand and the PageIndexChanged event  had been referenced.  It still did not however work in my original solution. 
The grid kept going through the itemdatabound event any time the link to the tooltip had been clicked, and even though the proper page would display the tooltips still would not show the correct data.
After tearing the page apart, to show and load just this grid, it would continue to pick up the Itemdatabound event everytime. 
My guess it had to do with the client events, listed in the grid I posted originally.  If you shut everything off and set the grid up exactly as shown in the zip file you will be good to go.
0
Daniel
Telerik team
answered on 14 Aug 2009, 11:19 AM
Hello Julie,

Could you please modify the project created by Sebastian in order to demonstrate the aforementioned behavior? I recommend you attach the sample back to the support ticket so we can debug it locally.

Best regards,
Daniel
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
Grid
Asked by
Julie
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Julie
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or