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

Dynamic link button on in OnAjaxUpdate

3 Answers 81 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Orest
Top achievements
Rank 1
Orest asked on 15 Oct 2009, 02:34 PM
Guys,
Can you please help me out here. I know I'm not a first person who is trying to   do this.

I have a RadListBox control that renders some stuff and on ItemDataBound I'm addind one of the control from the the item template to Tooltip manager.  

 

Control image = e.Item.FindControl("imgMenu");  
radTTMgr.TargetControls.Add(image.ClientID, e.Item.DataKey.ToString(), true);   
 

Tooltip manager has OnAjaxUpdate="OnAjaxUpdate"

in my Event Handler I create a new LinkButton and assigned an event handler for OnClick

 

 

protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs e) {  
    LinkButton lnkGoTo = new LinkButton();  
    lnkGoTo.CommandName = "goto";  
    lnkGoTo.CommandArgument = e.Value;  
    lnkGoTo.Click += new EventHandler(prodMenu_Click);  
    lnkGoTo.Text = "Go to Product";  
    lnkGoTo.ID= "lnkTemp";  
    e.UpdatePanel.ContentTemplateContainer.Controls.Add(lnkGoTo);  

So far so good here. Everything is executed correctly.  Now in my handler I have some code that should update the value of the editor control and this is not working. Content is being set be not being refreshed. I understand that this is an ajax call an all but how can i update the content in my scenario.

    protected void prodMenu_Click(object sender, EventArgs e) {  
        LinkButton lnkButton = (LinkButton)sender;  
        if (lnkButton == nullreturn;  
        rePresentation.Content = lnkButton.CommandName;          
    } 

Thanks!

 

 

 

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 20 Oct 2009, 09:04 AM
Hello Orest,

As far as I understood, you have a RadEditor with ID rePresentation which you want to update when you click a button which resides in the tooltip. I assume that your editor is outside the tooltip and this explains the behavior you describe which is teh expected one in such case. IN this configuration, teh button updates only the content of teh tooltip and no matter you set new content for the editor outside it, it does not get updated. What I can suggest to do in order to achieve the desired result is teh following:

1) Wrap the editor in an update panel with UpdateMode="Conditional", let's say the ID of the panel is UpdatePanel1.

2) Update manually the update panel in 1) after you have changed teh content of the editor as shown below:

protected void prodMenu_Click(object sender, EventArgs e) {   
       LinkButton lnkButton = (LinkButton)sender;   
       if (lnkButton == null) return;   
       rePresentation.Content = lnkButton.CommandName;  
       UpdatePanel1.Update();         
   }  

Lte me know how it goes and whether this fixed the problem.

Sincerely yours,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Orest
Top achievements
Rank 1
answered on 20 Oct 2009, 12:43 PM

Thank you Svetlina.

Your suggestion worked! But can I achieve this using radcontrols explicitly without using updatepanel?

Thanks!

0
Svetlina Anati
Telerik team
answered on 23 Oct 2009, 09:06 AM
Hello Orest,

There is no way to achieve what you want without using an additional update panel and this is not directly related to RadControls but to the way AJAX works. Let me explain in brief what is actually happenning in your case. The link button is inside the RadToolTip and since this is a LOD AJAX tooltip, this means that all teh tooltip content is in an update panel and this button is a trigger for updating this update panel. This means that when you click the button, you update only this part of the page which is inside the tooltip. In order to update another part of the page you should wrap it also in an update panel because this is how update panels work - if an update panel is updated, only this part of the page gets updated. This being said, the only possible solution is to also update the other part ofg the page you need by using another update panel.

I hope that my explanation is detailed enough and clear, let me know if you have additional questions.

Regards,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ToolTip
Asked by
Orest
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Orest
Top achievements
Rank 1
Share this question
or