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:
In the ProductDetails.ascx.cs, add the following code to the ShowCurrentDetails() method:
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:
Any ideas on what I'm doing wrong?
21 Answers, 1 is accepted
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:
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is the relevant code for updating the tooltip's content...
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.
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.
the Telerik team
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.
the Telerik team
The codebehind of the usercontrol is:
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!
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:
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.
the Telerik team
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 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:
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:
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.
the Telerik team
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.
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!
the Telerik team
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
You can set the TargetControlID of RadToolTip as ID of TextBox.
thanks for ur reply.actually you can see the textbox in the following link:
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.
solutions in chennai
website development solutions
You can try the following.
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
Dont say thanks for me friend.its all given by princy only.
|bca final year projects in Cegonsoft Bangalore | Chennai | Coimbatore|
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.