Tooltip TextBox values not updated

22 posts, 0 answers
  1. GcM
    GcM avatar
    7 posts
    Member since:
    Oct 2007

    Posted 16 May 2008 Link to this post

    I created a Tooltip based on the "Load On Demand" example.  In the tooltip I have an asp:Label and an asp:TextBox.  The values for these fields can change each time the tooltip is displayed.  When I initially display the tooltip, the label and textbox have the expected values.  However, when the tooltip is displayed the next time and I set different values for the label and textbox, the label shows the new value, but the textbox contains the original value.

    This behavior can be observed by making the following changes to Load On Demand example code:

    In the ProductDetails.ascx, add the following row to the "Product Wrapper" table:

    <tr> 
        <td> 
            <asp:TextBox ID="txtDT" runat="server" /> 
            <asp:Label ID="lblDT" runat="server" /> 
        </td> 
    </tr> 

    In the ProductDetails.ascx.cs, add the following code to the ShowCurrentDetails() method:

    String dt = DateTime.Now.ToLongTimeString(); 
    txtDT.Text = dt
    lblDT.Text = dt

    The label's value is changes on each time the tooltip is displayed, but the textbox's value retains the original timestamp.

    I also added the following code to the method UpdateToolTip(...) in Default.CS.aspx.cs, but it didn't help:

    panel.Update();  

    Any ideas on what I'm doing wrong?
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 19 May 2008 Link to this post

    Hi GcM,

    The problem comes from the fact that you set  the values for the TextBox in the Page_Load handler, however, in this case, you will have to do it at a later stage in the page lifecycle - for example, in the OnPreRender handler:

    protected void Page_Load(object sender, EventArgs e)  
    {  
        //this.ShowCurrentDetails();  
    }  
     
    protected override void OnPreRender(EventArgs e)  
    {  
        base.OnPreRender(e);  
        this.ShowCurrentDetails();  


    Kind regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 13 Aug 2009 Link to this post

    I am experiencing this same problem, but i can't quite follow the solution described here. I am using a load-on-demand Tooltip manager (as described in http://demos.telerik.com/aspnet-ajax/tooltip/examples/loadondemand/defaultvb.aspx) and I handle the ToolTipManager's OnAjaxUpdate event. There I get a reference to the User COntrol and initialize it based on a retrieval of database info. I have the same issue as described in this thread. When I display the first tooltip, all values are as they should be. If I display a second tooltip, all labels on the user control get updated properly, but a textbox still shows the same value as was shown in the first tooltip.

    Here is the relevant code for updating the tooltip's content...

     

    Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)

     

     

    Me.UpdateToolTip(args.Value, args.UpdatePanel)

     

     

    End Sub

     


    Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)  
                Dim ctrl As Control = Page.LoadControl("FileDetailControl.ascx")  
                panel.ContentTemplateContainer.Controls.Add(ctrl)  
                Dim details As FileDetailControl = DirectCast(ctrl, FileDetailControl)  
                AddHandler details.ControlEvent, AddressOf HandleFileDetailControlEvent  
                details.MyFileId = elementID
                details.Reload()  
            End Sub  
     
            Protected Sub HandleFileDetailControlEvent(ByVal sender As Object, ByVal e As GenericEventArgs)  
                Select Case e.CommandName  
                    Case "NeedDataSource"  
                        Dim detailControl As FileDetailControl = DirectCast(sender, FileDetailControl)  
                        detailControl.SetDataSource(GetFile(detailControl.MyFileId))  
     
                End Select  
     
            End Sub 

    in the UpdateToolTip method, the detail.Reload() line raises an event in the User Control which is handled in the handler listed above. This handler retrieves the data from the database and updates the usercontrol.
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Aug 2009 Link to this post

    Hi Albert,

    Did you try the solution we offered in this thread - to use the user control's PreRender event to set the values? I believe that this is the solution to your  problem, please apply the suggestion and test again. In case you continue experiencing problems, please open a new support ticket and send us a sample, fully runnable reproduction demo (use Northwind or a fake programmatic datasource if needed) along with detailed reproduction steps and explanations and we will do our best to help.


    Sincerely yours,
    Svetlina
    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.
  6. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 13 Aug 2009 Link to this post

    I'd love to implement the solution in this thread, but like I said, I don't quite understand how it applies. I am not doing anything in Page.Load (as far as I know). All I do is handle the tooltipmanager OnAjaxUpdate event. How would I go about making sure that this handler uses Page.PreRender instead of Page Lod (if that is what is happening)?
  7. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Aug 2009 Link to this post

    Hi Albert,

    You should see where you are populating the control with data - I cannot tell you this without having more of your code. As far as I can see, you have a public property called MyFiled and you pass an argument there. After that I see that you are extracting data based on it and setting some datasource. However, I do not see your text box there. In case the text box is in an item template, I suggest to dynamically databind the grid in the PreRender event - note that the PreRender event is for the user control itself (e.g in the FileDetailControl.ascx.vb) and it is not for the page.


    Sincerely yours,
    Svetlina
    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.
  8. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 13 Aug 2009 Link to this post

    Here is the markup of the usercontrol. TheTextBox (actual A RadTextbox, but this doesn't seem to matter) is at the bottom.:

    <asp:FormView ID="fileView" runat="server" Width="100%">  
            <ItemTemplate> 
                <table style="width: 100%;">  
                    <tr> 
                        <td style="width:100%;" colspan="2"><asp:Label CssClass="BMFileDetailHeader" ID="lblFileName" runat="server"><%# Eval("VirtualFilename")%><%#Eval("FileExtension")%></asp:Label><br /><hr /></td>  
                    </tr> 
                    <tr> 
                        <td class="BMFileDetailLeftCol" style="width:25%; vertical-align:top;">  
                            <asp:Image ID="BMFileDetailImage" Width="100" Height="100" runat="server" ImageUrl='<%# Eval("FileType.IconImage", "~/global/images/icons/{0}") %>' /> 
                        </td>          
                        <td style="width:75%; vertical-align:top; text-align:left;">     
                            <asp:Panel ID="pnlFile" runat="server" ScrollBars="Auto" Height="245px">  
                                <ul class="StructureList" style="padding:5px;">  
                                    <li class="BMFileDetailTitle">Title</li> 
                                    <li class="BMFileDetailInfo"><asp:Label ID="Label1" runat="server"><%#Eval("Title")%></asp:Label><br /><br /></li>  
                                    <li class="BMFileDetailTitle">Caption</li> 
                                    <li class="BMFileDetailInfo"><asp:Label ID="Label2" runat="server"><%#Eval("Caption")%></asp:Label><br /><br /></li>      
                                    <li class="BMFileDetailTitle">Description</li> 
                                    <li class="BMFileDetailInfo"><asp:Label ID="Label3" runat="server"><%#Eval("Description")%></asp:Label></li>  
                                </ul> 
                                <ul class="StructureList" style="padding:5px;" id="ulResource" runat="server" visible="false">  
                                    <li class="BMFileDetailTitle"><br />Resource Url</li> 
                                    <li class="BMFileDetailInfo">  
                                        <telerik:radtextbox id="txtResourceUrl"   
                                                            runat="server" 
                                                            Skin="Office2007"   
                                                            Width="350px">  
                                        <ClientEvents OnKeyPress="PreventKeyEntry" /> 
                                        </telerik:radtextbox> 
                                    </li> 
                                </ul> 
                                     
                            </asp:Panel> 
                        </td> 
                    </tr> 
                </table> 
            </ItemTemplate> 
        </asp:FormView> 

    The codebehind of the usercontrol is:

    Partial Public Class FileDetailControl : Inherits Control  
     
            Protected WithEvents txtUrl As RadTextBox  
     
            Public Property MyFileId() As String 
                Get 
                    Return ViewState("_FileId")  
                End Get 
                Set(ByVal value As String)  
                    ViewState("_FileId") = value  
                End Set 
            End Property 
     
            
              
            Public Sub New()  
     
            End Sub 
     
            Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
                SetTemplatedControls()  
                 
            End Sub 
     
                    Private Sub SetTemplatedControls()  
                txtUrl = fileView.FindControl("txtResourceUrl")  
     
                 
                  
                  
            End Sub 
     
            Public Sub Reload()  
                RaiseControlEvent(MeNew GenericEventArgs("NeedDataSource"New List(Of Object)))  
            End Sub 
     
            Public Shadows Sub SetDataSource(ByVal file As HLFile)  
                Dim list As New RichList(Of HLFile)  
                list.Add(file)  
                fileView.DataSource = list  
                fileView.DataBind()  
            End Sub 
     
            Private Sub fileView_DataBound(ByVal sender As ObjectByVal e As System.EventArgs) Handles fileView.DataBound  
                SetTemplatedControls()  
                Dim file As HLFile = CType(fileView.DataItem, HLFile)  
     
                Dim url As String = file.FullVirtualName  
                txtUrl.Text = url  
     
            End Sub 
     
        End Class 

    The two key methods are SetDataSource which binds the FormView (named fileView )and the dataBound handler for the FormView below that. So, looking at what I sent you earlier.. the flow is as follows:

    1) Hovering over an item (in a grid) displays the Tooltip . This is all managed by the standard load-on-demand structure you have in the example I referenced earlier. If you need me to provide this code, I can, but it is pretty much just like your example.

    2) The OnAjaxUpdate Event of the tooltip manager is raised. I have a handler (in my previous post) which gets the element id and loads and initializes the usercontrol. The elementId (I store the FIle id in this item) is passed to the user control and the control is prompted to "Reload".

    3)The user Control raises the "Need DataSource" event, which is handled back on my page. This retrieves the data (the file info) from a database and then the passes it to the Usercontrol's SetDataSource method, which I reference above. This populates the formview on the user control

    You might be wondering why such a complicated flow, but I didn't want the UserControl to have any data retrieval logic in it, so I implemented the "NeedDataSource" event, similar to what you guys use in your grid control.

    Anyhow, I can open a support ticket if I need to, but I feel like I am just missing something basic here. I'm stil not really sure what you are referring to when you say I can load the the data in Page.PreRender instead of Page Load. As I have described, the loading of the data occurs in response to an AjaxUpdate of the ToolTipManager. Sure, the Page.Load event fires for both the page and usercontrol in this case, however, I don't explicitly use either of those events to load the data, so I'm not sure what change I need to make to utilize PreRender.

    Thanks for your help!
  9. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 19 Aug 2009 Link to this post

    Hello Albert,

    As far as I can see from your code, you are setting the new value in teh SetTemplatedControls method. If so, you should modify the code-behind of teh user control in similar manner as shown below:

    ..............................  
    ..............................  
    Protected Overloads Overrides Sub OnPreRender(e As EventArgs)  
        SetTemplatedControls()  
    End Sub 

    In case you still need further assistance, please open a support ticket and provide a sample demo which can be directly run along with instructions and I will modify it for you. 


    Kind regards,
    Svetlina
    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.
  10. Shawn Krivjansky
    Shawn Krivjansky avatar
    86 posts
    Member since:
    Jan 2010

    Posted 17 Aug 2010 Link to this post

    I'd like to re-open this issue...
    I just spent the better part of a day trying to narrow-down what the issue was with this...once narrowing it down, I came to discover the weird difference with textboxes vs any other control (at least most others... haven't tried them all).  After spending an hour trying to formulate what it is that I should search for ("textbox holds value"..."textbox not repopulated"... or similar unspecific searches that lead no where), I stumbled onto this forum post (thankfully...before I pulled my hair out).

    Yes, the "Do it in PreRender" solution works.  However, my problem is that most people use the demos as an example/blueprint for how to perform an operation/task.  The demo does NOT use PreRender.  It uses Page Load.  So, guess what everybody is going to use??  Page Load.  There isn't a single person that would out of the blue use PreRender for this...ESPECIALLY if the demo does not.  Therefore, I would venture to say that every single person new to this particular scenario (trying it for the first time) using textboxes would have this problem.  Why not just change the demo code to use PreRender??????  That would solve everybody's problem and not have them waste time on such a silly thing.  I'm sure most will probably just give up or else enter a support ticket that needs to be answered a million times.

    I mean...
    I would also LOVE to know WHY this isn't a problem with LABEL controls but IS problem with Textboxes, but at least update the Demo code...or at the VERY VERY least make a statement in the "description" for the demo that this will NOT work with Textboxes and what to do if you do want to use Textboxes (or any other control that might not work).

    I'm just frustrated that I spent the whole day on something that could've been EASILY avoided.
    If the "solution" is to use PreRender, then how about "fixing" the apparently broken demo that uses Page Load:
    http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

  11. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 20 Aug 2010 Link to this post

    Hi Shawn Krivjansky,

     I understand your frustration and we will consider your feedback about emphasizing on this. However, the demo you linked does not need to set values in PreRender since it does not use controls which ViewState is causing the need to use PreRender. However, if you examine the other demos you will find such that actually use it, e.g the following one:

    http://demos.telerik.com/aspnet-ajax/tooltip/examples/loadondemand/defaultcs.aspx

    Let me explain in brief why we chose to fire the OnAjaxUpdate so early in the life cycle because this is done on purpose. 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. We believe that setting a value in PreRender is the easiest part of code to leave for the developer and it is also not needed in all scenarios - e.g in the demo you have linked, while recreation of dynamically created and added controls will be needed in any LOD scenario. Note, also, that the main purpose of the control is to be used for presentation purposes, despite it could be used as a dialog but the purpose of a dialog is the base of RadWindow and every control should work according to its main purpose out of the box and if it could be fine-tuned for other purposes this might need some code. As to your question about the Label and the TextBox, the difference in their behavior is in the ViewState and it is caused by the main difference between the two controls which is that the Label can't be edited and the TextBox could be edited and the value should be passed to the server by using the ViewState.

    I hope that my reply is detailed enough and answers your questions. Let us know if you have additional questions or you need help in your implementation.

    Regards,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Shawn Krivjansky
    Shawn Krivjansky avatar
    86 posts
    Member since:
    Jan 2010

    Posted 20 Aug 2010 Link to this post

    Thank you for taking the time to explain.

    I understand that the demo that I have linked to did not NEED to use PreRender.  But, it would not HURT to use PreRender either.  In this case, the least common denominator of making sure everybody's use of the process will work (regardless of how simple or complicated they make the tooltip)...would be to use PreRender.  Some people (probably a lot) won't even care about the REASON why it is necessary to use PreRender in "some" situations.  As long as they know TO USE it to make all their situations work...would be perfectly fine.

    Now that you have explained things, I understand the WHY.  I would not have cared that much or even thought about putting a support ticket in or posting on a forum if the slightly altered tooltip that I have (with textboxes) would've worked based on the same blueprint as the demo.  Yes, it is frustrating for the developers..., but it also creates much more work for Telerik to answer support tickets and forums posts.  I would think you would want to minimize these types of situations as much as possible.  In this case, it seems like a no-brainer...  avoid any confusion/frustration by the developers and no support tickets/forum posts...just by using PreRender instead of Page Load.  I understand some situations aren't this easy, but you should take them where you can get them.

    Regarding the demo that you linked to...
    Yes, I had seen this one before as well.  But, it is also slightly unclear.  It uses BOTH Page Load and PreRender to call the main ConfigureView method.  I don't need an explaination why.  I'm just saying that this demo didn't shine a spotlight on my problem when I didn't completely understand what was going on.

    Again, thank you for the explanation.
  13. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 31 Aug 2010 Link to this post

    Hi Shawn Krivjansky,

    I am glad that my explanation was helpful in understanding the reason for the need of the PreRender event usage to set new values. I also see your point regarding the demos but this was not an issue till now because there is not a lot support generated by this, However, I will forward your suggestion of changing all the demos to use PreRender and we will probably do so, depending on the decision taken.

    Thank you once again for your feedback! 

    All the best,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 29 Oct 2011 Link to this post

    hi all,

    I am using a textbox in my website.that textbox was small to see.i am trying to show tooltip for that textbox.i used all the coding according to my view.but its not working.can anyone give the solutions for it?

    website development services in bangalore
    ______________________________________________
    website development services
  15. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2011 Link to this post

    Hello Williams,

    You can set the TargetControlID of RadToolTip as ID of TextBox.

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="ABC" Width="20px">
    </telerik:RadTextBox>
    <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="RadTextBox1" Text="ABC">
    </telerik:RadToolTip>

    Thanks,
    Princy.
  16. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 29 Oct 2011 Link to this post

    hi princy,

    thanks for ur reply.actually you can see the textbox in the following link:

    http://www.cegonsoftfaq.com/

    if anyone type the answer or question in that textbox.that have to show the tooltip as what they have written.i will try with ur suggestion and do revert.

    website development solutions in chennai
    __________________________________
    website development solutions


  17. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 31 Oct 2011 Link to this post

    Hello Williams,

    You can try the following.

    C#:
    protected void btn_Click(object sender, EventArgs e)
    {
      RadToolTip1.Text = RadTextBox1.Text;
    }

    Thanks,
    Princy.
  18. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 31 Oct 2011 Link to this post

    hi princy,

    once again,Thanks for ur Reply,but u mentioned to use RadToolTip1.Text = RadTextBox1.Text; in the btn_click event.i cant found a radtooltip event in our vs2008.
    how to use the radtooltip tool.

    website development firm in bangalore
    _____________________________________
    website development firm 


  19. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2011 Link to this post

    Hello Williams,

    You can try the following javascript in OnKeyPress event of TextBox.

    JS:
    <script type="text/javascript">
     var textbox_text="";
     function OnKeyPress(sender, args)
     {
      var toolTip = $find('<%=RadToolTip1.ClientID%>');
      var temp=   args.get_keyCharacter()
      textbox_text += temp;
      toolTip.set_text(textbox_text);
     }
    </script>

    Thanks,
    Princy.
  20. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 04 Nov 2011 Link to this post

    hi Princy,

    Thanks for your Replies.it helped me in coding very much.


    web development solutions in bangalore
    ________________________________
    web development solutions
  21. Muveen
    Muveen avatar
    1 posts
    Member since:
    Nov 2011

    Posted 26 Nov 2011 Link to this post

    hi williams,

    thanks for your question in tooltip and i too searched for that and now i cleared the answers


    __________________________
    be final year projects
  22. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 28 Nov 2011 Link to this post

    hi muveen,

    Dont say thanks for me friend.its all given by princy only.


    _____________________________
    bca final year projects in Cegonsoft Bangalore | Chennai | Coimbatore
  23. Williams
    Williams avatar
    7 posts
    Member since:
    Oct 2011

    Posted 30 Nov 2011 Link to this post

    hi princy,

    I have one question for you.pl do reply if you know about this that ! is it possible to run a setup file created on astrum installer in iphone?actually i created a setup file using that installer package.if u have any other idea to create a setup file and it should be executable on iphones.

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