
Martin Sarosi
Top achievements
Rank 2
Martin Sarosi
asked on 06 Jan 2009, 11:41 AM
Hi I have a rad tooolbar with a bunch of buttons but I want each button to update a different control.
Is this possible?
Marty
Is this possible?
Marty
5 Answers, 1 is accepted
0
Hello Martin,
Please refer to:
http://www.telerik.com/support/kb/aspnet-ajax/toolbar/updating-different-control-with-ajax-depending-on-clicked-toolbarbutton.aspx
All the best,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please refer to:
http://www.telerik.com/support/kb/aspnet-ajax/toolbar/updating-different-control-with-ajax-depending-on-clicked-toolbarbutton.aspx
All the best,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Martin Sarosi
Top achievements
Rank 2
answered on 07 Jan 2009, 10:07 AM
Thanks Dimo
The problem I have is more to do with Ajax so the demo in the link is fine but...the response still updates the CheckboxList it is ijust that it has been altered.
I would like to exclude CheckboxList from the list of updated controls according to the button pressed so:
is returned when New is pressed rather than including
the CheckBoxList as well
Apologies for not making myself clear before.
Cheers
Marty
The problem I have is more to do with Ajax so the demo in the link is fine but...the response still updates the CheckboxList it is ijust that it has been altered.
I would like to exclude CheckboxList from the list of updated controls according to the button pressed so:
|242|updatePanel|ListBox1Panel|<select size="4" name="ListBox1" id="ListBox1" style="height:191px
;width:34px;z-index: 102; left: 204px; position: absolute; top: 87px">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
is returned when New is pressed rather than including
402|updatePanel|CheckBoxList1Panel|<table id="CheckBoxList1" border="0" style="height:51px;width:26px
;z-index: 101; left: 251px; position: absolute; top: 91px">
<tr>
<td><input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" /><label for="CheckBoxList1_0"
>1</label></td>
</tr><tr>
<td><input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" /><label for="CheckBoxList1_1"
>2</label></td>
</tr>
</table>
the CheckBoxList as well
Apologies for not making myself clear before.
Cheers
Marty
0
Hello Martin,
I am afraid I still do not understand what you are trying to do and how is the CheckBoxList related to the RadToolBar. Please provide more details and a sample web page.
Kind regards,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I am afraid I still do not understand what you are trying to do and how is the CheckBoxList related to the RadToolBar. Please provide more details and a sample web page.
Kind regards,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Martin Sarosi
Top achievements
Rank 2
answered on 07 Jan 2009, 02:27 PM
Apologies for not being clear Dimo.
I have a toolbar with two buttons on it. Button1 and Button2
Button1 is going to affect quite a large part of the page , panel1.
Button2 is going to affect only a small part of the page, panel2
the toolbar is the initiating control in the Ajax request
with panel1 and panel2 in the controls to update list
So as it stands at the moment although clicking Button2 causes panel2 to be changed panel1 and panel2 must come back in response to the Ajax request initiated by the toolbar. I only want to get panel2 back in the response.
This means I am gettting a lot more back then I need.
So what I would like is to say Button2 initiated this request I can update the contents of panel2 and in the repsonse only return panel2
Does that make more sense. I have a bit of cold.
Thanks
Marty
I have a toolbar with two buttons on it. Button1 and Button2
Button1 is going to affect quite a large part of the page , panel1.
Button2 is going to affect only a small part of the page, panel2
the toolbar is the initiating control in the Ajax request
with panel1 and panel2 in the controls to update list
So as it stands at the moment although clicking Button2 causes panel2 to be changed panel1 and panel2 must come back in response to the Ajax request initiated by the toolbar. I only want to get panel2 back in the response.
This means I am gettting a lot more back then I need.
So what I would like is to say Button2 initiated this request I can update the contents of panel2 and in the repsonse only return panel2
Does that make more sense. I have a bit of cold.
Thanks
Marty
0
Hello Martin,
In order to achieve what you want, you need to set two different controls as AJAX request initiators for the two panels. So neither RadToolBar, nor RadAjaxManager are suitable for this purpose.
I am offering you the following approach - use two hidden asp:Buttons as AJAX initiators for the two asp:Panels. The buttons will be clicked programmatically in the RadToolBar buttons' client-side click event handlers. Here is an example:
Kind regards,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
In order to achieve what you want, you need to set two different controls as AJAX request initiators for the two panels. So neither RadToolBar, nor RadAjaxManager are suitable for this purpose.
I am offering you the following approach - use two hidden asp:Buttons as AJAX initiators for the two asp:Panels. The buttons will be clicked programmatically in the RadToolBar buttons' client-side click event handlers. Here is an example:
<%@ Page Language="C#" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<script runat="server"> |
protected void Button1_Click(object sender, EventArgs e) |
{ |
ThreadWait(); |
Literal1.Text = DateTime.Now.ToLongTimeString(); |
} |
protected void Button2_Click(object sender, EventArgs e) |
{ |
ThreadWait(); |
Literal2.Text = DateTime.Now.ToLongTimeString(); |
} |
protected void ThreadWait() |
{ |
System.Threading.Thread.Sleep(2000); |
} |
</script> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
<title>RadControls for ASP.NET AJAX</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackColor="White" Transparency="50" /> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="Button1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="Panel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="Button2"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="Panel2" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<div style="display:none"> |
<asp:Button ID="Button1" runat="server" Text="AJAX 1" OnClick="Button1_Click" /> |
<asp:Button ID="Button2" runat="server" Text="AJAX 2" OnClick="Button2_Click" /> |
</div> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function ClientButtonClicked(sender, args) |
{ |
var clickedButton = args.get_item().get_index(); |
if (clickedButton == 0) |
{ |
$get("<%= Button1.ClientID %>").click(); |
} |
else if (clickedButton == 1) |
{ |
$get("<%= Button2.ClientID %>").click(); |
} |
} |
</script> |
</telerik:RadCodeBlock> |
<telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicked="ClientButtonClicked"> |
<Items> |
<telerik:RadToolBarButton Text="Update 1" /> |
<telerik:RadToolBarButton Text="Update 2" /> |
</Items> |
</telerik:RadToolBar> |
<div style="clear:both"><!-- --></div> |
<br /><br /> |
<asp:Panel ID="Panel1" runat="server" BackColor="#eeeeee"> |
Panel 1<br /> |
Panel 1<br /> |
Panel 1<br /> |
Panel 1<br /> |
Panel 1<br /> |
<asp:Literal ID="Literal1" runat="server" Text=" " /> |
</asp:Panel> |
<br /><br /> |
<asp:Panel ID="Panel2" runat="server" BackColor="#dddddd"> |
Panel 2<br /> |
Panel 2<br /> |
Panel 2<br /> |
Panel 2<br /> |
Panel 2<br /> |
<asp:Literal ID="Literal2" runat="server" Text=" " /> |
</asp:Panel> |
</form> |
</body> |
</html> |
Kind regards,
Dimo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.