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

Postback in Tooltip not update content of html page

8 Answers 183 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Eim
Top achievements
Rank 1
Eim asked on 27 Apr 2009, 01:10 PM
Hi,
 I used a tooltip with loadOnDemand for dynamically content.
 Inside the tooltip there is a telerik menu that generate a postback.
 After postback the content of page (outside tooltip) is not update, why?
It seem an "ajax" postback, but i need a real postback that update everything.
How can I do ?, please help me, it is urgent :(

Regards
 Alessandro.

Ignore post, because I just Opened now  a support ticket

8 Answers, 1 is accepted

Sort by
0
Scott
Top achievements
Rank 2
answered on 31 May 2009, 08:13 PM
I'm interested in the solution if you have it.

I'm loading a control within a tooltip and it's viewstates are not being updated.  When the tooltip loads the control, the IsPostBack is true immediately.
0
Tervel
Telerik team
answered on 01 Jun 2009, 07:58 AM
Hello Scott,

Here is what we answered to Alessandro in the support ticket that he sent:
=================================================================
Hi EUROSOFT,

When you perform an ajax request through the tooltip, you actually update only the content of the tooltip. The server code which updates the other part of the page gets executed, but it is not actually rerendered and this is the expected behavior - it is the same as if you have an update panel instead of a tooltip - only the content of the update panel gets updated.

I suggest to use one of the following options:

  1. Wrap the content in an update panel with UpdateMode="Conditional" and call its update method in the OnAjaxUpdate event - for your convenience I prepared and attached a sample demo.
  2. Use a separate tooltip control instead of using the RadToolTipManager - the separate RadToolTip is not ajaxified.
  3. Use client javascript code to submit the form.

I hope that my explanations, suggestions and demo are helpful, let me know how it goes.

=============================================================================

Based on our answer, he developed a workaround that worked in his scenario - here is his answer:

=============================================================================

Hi,
 Yesterday I did a workaround exactly like showed in point 3.
>> Use client javascript code to submit the form.

Inside a tooltip it's dinamically rendered a RadMenu with many items..

But I don't like much the solution, because i had to move the Menu_Item Clicked on client side,use a hidden field to store the menuitem value clicked, then fire a real postback by client side.
But if i Had others controls (inside tooltip) that need a realpostback i had to do the same for all controls...

I did so and if works ...

 

<asp:LinkButton ID="lnkTelerikfix_popupmenu" runat="server" OnClick="lnkTelerikfix_popupmenu_Click" />
<asp:TextBox ID="txtTelerikfix_popupmenu" runat="server" Visible="true" EnableViewState="false" CssClass="HiddenObject" />

 
<script language="javascript" type="text/javascript">
function popupmenuClicked(sender, args)
{
//var clipboardElement = $get("hdClipboard");
var itemValue = args.get_item().get_value();
var lnkTelerikfix_popup = document.getElementById('<%= lnkTelerikfix_popupmenu.ClientID %>');
var txtTelerikfix_popup = document.getElementById('<%= txtTelerikfix_popupmenu.ClientID %>');
if (itemValue && itemValue != null )
{

  txtTelerikfix_popup.value = itemValue;

  EimNameSpace.FireButtonByObject(lnkTelerikfix_popup);

 }

return;
}


then server side ... :

 

protected void lnkTelerikfix_popupmenu_Click  (object sender, EventArgs e)
{
string value = txtBugfix_popupmenu.Text;
if (string.IsNullOrEmpty(value) || value.ToLower() == "null") return;
PopUpMenuCalendarClick(value);
....

}




Best regards,
Tervel
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
Scott
Top achievements
Rank 2
answered on 01 Jun 2009, 11:47 PM
thanks for the reply but this didn't solve my problem.  I opened a support ticket Sunday and waiting for a response.

Basically, I have tootip in my datagrid that loads a usercontrol.  The usercontrol accepts a value and loads the appropriate data. But the user control inside the tooltip requires user interaction and postback.  The viewstate within the user control isn't working. Postback is always set to true even on the initial load.   I have attached the user control in the ticket for your review.

Thanks.

0
Neil
Top achievements
Rank 1
answered on 04 Jun 2009, 02:34 PM
If I understand you I had a similar situation. I have a radgrid that displays a tooltip where the contents of the tooltip are loaded from a user control. And inside the user control I needed postback in order to maintain a page counter to flip between pages of an image. I couldn't use ViewState because it won't be maintained in the page's viewstate in this ajax method. After a lot of trial and error I came up with a workaround (OK, kluge) that worked for me.

With the rad ajax implementation the controls themselves maintain their viewstate but that's all. So I created a textbox with a css style display:none that had a tokenized version of the information I wanted. Every time an event occured I read the value, made changes, set the new text value, and moved on. It's klunky but it worked great and without a lot of rework of code. Kind of a poor man's viewstate if you think about it.

BTW, I also found that trying to use session in this context didn't work, either. Only this method worked for me. Maybe it helps, maybe it doesn't but I thought I'd share in case it does.
0
Scott
Top achievements
Rank 2
answered on 04 Jun 2009, 05:03 PM
That didn't for me when I tried.   I decided to use radWindows modal instead for the temporary solution. Support was able to replicate the problem and are looking into it.  They don't know if it is caused by the framework or their product.
0
Svetlina Anati
Telerik team
answered on 05 Jun 2009, 02:46 PM
Hello guys,

The tooltip maintains the ViewState of the loaded user control.

Niel, I am not sure what exactly is the ViewState problem you experience. However, since you have found a solution I recommend to stick to it. In case you would like to further investigate the problem, please provide more detailed and clear explanations.

Scott, we researched further the setup you describe and it turned out that the described behavior is the one which you observe when implementing this scenario with the Framework itself and it is not related to RadControls. I also provided you with a sample demo which reproduces the behavior without any RadControls to confirm this. You can find more details about this on the net, e.g below:

http://objectmix.com/dotnet/374440-ajax-ispostback.html
http://blogs.clearscreen.com/enadan/archive/2006/02/21/2838.aspx

As you can read there, an update panel async callback does set IsPostBack to  true and since the user control is loaded using AJAX this is expected.

For your convenience I prepared a sample demo which implements the scenario you required - just use the same logic for your original project and replace the code which indicates whether this is a postback or not with the particular code you want to execute on first load and on postback in the user control itself.

Best wishes,
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.
0
Svetlina Anati
Telerik team
answered on 05 Jun 2009, 02:46 PM
Hello Scott,

We researched further the setup you describe and it turned out that the described behavior is the one which you observe when implementing this scenario with the Framework itself and it is not related to RadControls. I also provided you with a sample demo which reproduces the behavior without any RadControls to confirm this. You can find more details about this on the net, e.g below:

http://objectmix.com/dotnet/374440-ajax-ispostback.html
http://blogs.clearscreen.com/enadan/archive/2006/02/21/2838.aspx

As you can read there, an update panel async callback does set IsPostBack to  true and since the user control is loaded using AJAX this is expected.

For your convenience I prepared a sample demo which implements the scenario you required - just use the same logic for your original project and replace the code which indicates whether this is a postback or not with the particular code you want to execute on first load and on postback in the user control itself.




Best wishes,
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.
0
Neil
Top achievements
Rank 1
answered on 05 Jun 2009, 03:23 PM
I'm OK with my workaround for now but here is a condensed version.

Logical layout of panels/etc:

Page
- Update Panel
-- RadGrid
-- RadToolTipManager
---User Control (loaded by tooltip on mouse over, ajaxupdate, loadcontrol)
----RadToolBar
----Table
-----MultiView

The toolbar has two buttons to move the page index back and forth. They are set with the CommandArgument and fired in the OnButtonClick handler.

In the user control I had a property for current index that stored its value in viewstate. When I would alter the value in the OnButtonClick handler the property would change its value correctly. But on the next postback (user clicking button) the original value set in the first use of the property would always be returned. The page wouldn't retain a viewstate change I made during the event handling. As I recall, since this was a couple of weeks ago, I read that Telerik's controls would maintain viewstate in this situation but that was it. So I figured that if I had a text control maintain my change then it would preserve the updated value since setting ViewState directly for my property didn't maintain the value on postback. And it worked.
Tags
ToolTip
Asked by
Eim
Top achievements
Rank 1
Answers by
Scott
Top achievements
Rank 2
Tervel
Telerik team
Neil
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or