Hi Fred,
You can use our CallbackPanel. You generally do not need to change any of your existing code to use our CallbackPanel. In order to use CallbackPanel, you need to:
1. Put a CallbackPanel around the region you want to AJAX update;
2. Set the CallbackPanel's Trigger property to include the control that you would like to trigger the Callback.
For example, let say you have a simple Button and Label in the page, and when user click the button, the page posts back and update the label to display the current time:
Code: HTML/ASPX
<asp:Button runat="server" id="Button1" Text="Test">
<asp:Label runat="server" id="Label1">
Code behind:
Code: C#
private void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
If you want to AJAX update the label, you can change your ASPX to:
Code: HTML/ASPX
<asp:Button runat="server" id="Button1" Text="Test">
<eo:CallbackPanel runat="server" id="CallbackPanel1"
Triggers="{ControlID:Button1;Parameter:}">
<asp:Label runat="server" id="Label1">
</eo:CallbackPanel>
Note you have put a CallbackPanel around Label1 and also have "Button1" included in its Triggers collection. You do not need to change any code behind. In reality you would usually put more than one controls inside the CallbackPanel. The CallbackPanel defines the boundary of the AJAX-updated region.
This does not solve your second scenario. For the second sceanrio, you will need to change your code. In short, you can not use Response.Write when AJAX updating your page (this is why none of the solution you have tried worked). Fortunately, there is an easy workaround that is possible with our CallbackPanel. As a general rule, you can replace any Response.Write with a Label control. For example, if your original code is:
Response.Write(
"<script type=\"text/javascript\">window.alert('hi');</script>");
You can put an asp:Label in your ASPX file, then replace Response.Write with:
Label1.Text =
"<script type=\"text/javascript\">window.alert('hi');</script>";
Obviously, the Label control has to be placed at the where you want that code to be. Once you replace your Response.Write with Label control and the corresponding code that sets the Label's Text, you should be all set. Make sure you have type="text/javascript" with your script tag.
For more detailed information, you can refer to our help file. You can also load and run our demo project to see how it works. Both are installed locally on your machine if you install our controls. Sample project are provided in Visual Studio 2003, 2005 and 2008 project format.
Thanks