ToolTipUpdateEventArgs always returns first value

5 posts, 0 answers
  1. Chuck Lawson
    Chuck Lawson avatar
    7 posts
    Member since:
    Jul 2008

    Posted 05 Jan 2011 Link to this post

    I have a gvidview that I am attempting to set up so that as I hover over the various rows I get a popup(ascx file)  with the info for that row
    When I populate the grid and hover over the items I always receive the popup for the first row regardless which row I hover over.
    Any thoughts?

    Here is the code for the rowdatabound and the OnAjaxUpdate functions.

    protected void gvSelected_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    Vehicle v = (Vehicle)e.Row.DataItem;
    string avinnumber = v.Vin;
    VinRadToolTipManager.TargetControls.Add(e.Row.ClientID, avinnumber, true);
    }
    }

    //**************** Passing Wrong value !!!!!!!!!!!!!!!!!!!!!!!!!!

    protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
    {
    Control ctrl = Page.LoadControl("infovin.ascx");
    args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl);
    InfoVin details = (InfoVin)ctrl;
    details.Avinnumber = args.Value;
    }

    Here is my ToolTipManager and Grid
    <telerik:RadToolTipManager ID="VinRadToolTipManager" runat="server" Position="BottomCenter"
    Animation="None" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Mouse" Width="350px"
    Height="150px" Style="font-size: 18px; text-align: center; font-family: Arial;"
    RenderInPageRoot="true" skin="WebBlue" HideEvent="LeaveToolTip" AutoCloseDelay="0" Sticky="false">
    </telerik:RadToolTipManager>

     

     

     

     

    <table width = "100%">
        <tr>
           
    <td align="center" valign="top"> <asp:Label id="srMessage" Font-Bold="true" ForeColor="Red" runat="server"/>
               
    <asp:Panel id="multiResults" runat="server">
                   
    <table width="100%">
                        <tr>
                           
    <td align="center">
                                 <asp:Label id="lblMultiGrid" Font-Bold runat="server" />


    <asp:GridView ID="gvSelected" runat="server" ItemStyle-VerticalAlign=Top align=left AllowPaging="false" onRowDataBound="gvSelected_RowDataBound" OnRowCreated="gvSelected_RowCreated" OnSelectedIndexChanged="gvSelected_SelectedIndexChanged" PageSize="15" AutoGenerateColumns="False" ShowFooter="false" Width="100%" >

            
    <Columns>
               
    <asp:BoundField HeaderText="VIN" DataField="Vin" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Year" DataField="Modelyear" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Manufacturer" DataField="Make" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Model" DataField="Model" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Body Style" DataField="Bodystyle" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Coll" DataField="Collsymbol" HeaderStyle-HorizontalAlign="Left"/>    
               
    <asp:BoundField HeaderText="Comp" DataField="Compsymbol" HeaderStyle-HorizontalAlign="Left"/>
               
    <asp:BoundField HeaderText="VSR" DataField="symbol" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="AntiTheft" DataField="Antitheft" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="Passive Restraint" DataField="Restraint" HeaderStyle-HorizontalAlign="Left"/>
               <asp:BoundField HeaderText="AntiLock Brakes" DataField="Antilockbrakes" HeaderStyle-HorizontalAlign="Left"/>
            </Columns>
    </asp:GridView>

     

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </asp:Panel>

     

     

     

     

     

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 10 Jan 2011 Link to this post

    Hello Chuck,

    You have not shared the user control's code but i assume that you have controls with ViewState in it and you set the new value in the OnLoad event. If my assumption is correct, this is the reason for the problem and you should set the new values in OnPreRender - let me explain in brief why this is so.

    When we add to the tooltip controls with ViewState we have to make sure that these controls are created before the LoadViewState event fires so that their ViewState information is loaded. In order to avoid forcing our clients to recreate all their controls in the Init event on postback, we decided to fire the AjaxUpdate event earlier in the page lifecycle. That is why when you get the old ViewState values.

    This being said, please move the code in the user control which sets the new values in the PreRender event, test again and let us know how it goes.


    All the best,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chuck Lawson
    Chuck Lawson avatar
    7 posts
    Member since:
    Jul 2008

    Posted 12 Jan 2011 Link to this post

    Not completely sure I understand.
    Here is code from the ascx user control that I have created to be a popup with the resulting tooltip:

    void Page_Load(object sender, EventArgs e)
        {
            SqlConnection m_SqlCon = CIC.Common.CommonFunctions.OpenDatabase("online_vin_lookup");
            SqlCommand m_Cmd = new SqlCommand("Lookupbyvin", m_SqlCon);
            m_Cmd.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameterCollection m_Params = m_Cmd.Parameters;
            m_Params.AddWithValue("@vin", Avinnumber);
              
              
            SqlDataReader dr = null;
            try
            {
                m_SqlCon.Open();
                dr = m_Cmd.ExecuteReader(CommandBehavior.SingleRow);
                if (dr.Read())
                {
                    lblVin.Text = dr["vin"].ToString();
                    lblPassiveRestraint.Text = dr["restraint"].ToString();
                    lblYear.Text = dr["year"].ToString();
                    lblManufacturer.Text = dr["manufacturer"].ToString();
                    lblModel.Text = dr["model"].ToString();
                    lblBodystyle.Text = dr["bodystyle"].ToString();
                    //lblBodystyle.Text = Avinnumber;
                    lblClass.Text = dr["class"].ToString();
                    if (Convert.ToInt32(lblYear.Text) < 2011)
                    {
                        lblCollisionsymbol.Text = "n/a";
                        lblCompsymbol.Text = "n/a";
                    }
                    else
                    {
                        lblCollisionsymbol.Text = dr["colsymbol"].ToString();
                        lblCompsymbol.Text = dr["compsymbol"].ToString();
                    }
                    lblCylinders.Text = dr["cylinders"].ToString();
                    lblEngine.Text = dr["engine"].ToString();
                    lblWheeldrive.Text = dr["wheeldrive"].ToString();
                    lblPerformance.Text = dr["performance"].ToString();
                    lblRunninglights.Text = dr["dayrunninglights"].ToString();
                    lblAntitheft.Text = dr["antitheft"].ToString();
                    lblAntilockbrakes.Text = dr["antilockbrakes"].ToString();
                      
                      
                }
                else
                {
                    lblVin.Text = dr["vin"].ToString();
                     
                   //Need a nothing found message
                }
                dr.Close();
            }
            finally
            {
                m_SqlCon.Close();
            }
        }
       
        private string avinnumber;
      
        public string Avinnumber
        {
            get { return avinnumber; }
            set { avinnumber = value; }
        }

    When I changed on-load to prerender I got no data returning to the control.

    Thanks for any suggetions you may have.
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 17 Jan 2011 Link to this post

    Hello Chuck Lawson,

     The provided code is not enough to understand why you get no data when you move it in the PreRender event and thus I will really need to examine a simple, fully runnable reproduction demo. Please, prepare such a demo (you can use a fake programmatic datasource, no need for complex custom logic, masterPages, database, etc - only a stripped down runnable setup which reproduces the configuration and the issue), open a new support ticket and send it to us along with very detailed step by step instructions, explanations and screenshots. Once we receive this, we will examine, debug and fix this demo and you will be then able to apply the same logic in your original application.

    All the best,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Chuck Lawson
    Chuck Lawson avatar
    7 posts
    Member since:
    Jul 2008

    Posted 25 Jan 2011 Link to this post

    It turns out that the problem was with the clientid. 
    I was getting the same client id for all rows in the grid.
    I added ClientIDMode="AutoID" to the gridview and all is well!

     

     

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017