Hey, I'm sure this is a simple task, but I'm having a difficult time getting this to work.
The custom control will eventually be more complex. I'm just trying to JAX the control before I begin really building it out. However, I can't get the controlled JAX'ed nor the Loading Panel working.
All I want in the below sample is a .NET panel control with a label and button. When the button is clicked, I put the thread to sleep for 2 seconds. I want the click to be asyncronous and display a loading panel across the entire .NET panel.
Here's what I've got:
Thanks,
Joshua
The custom control will eventually be more complex. I'm just trying to JAX the control before I begin really building it out. However, I can't get the controlled JAX'ed nor the Loading Panel working.
All I want in the below sample is a .NET panel control with a label and button. When the button is clicked, I put the thread to sleep for 2 seconds. I want the click to be asyncronous and display a loading panel across the entire .NET panel.
Here's what I've got:
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using Telerik.Web.UI; |
namespace Elevate.UI.WebControls |
{ |
[ToolboxData("<{0}:SearchAjax runat=server></{0}:SearchAjax>")] |
public class SearchAjax : Control, INamingContainer |
{ |
#region private properties |
private Unit _width; |
#endregion |
#region public accessors |
public Unit Width |
{ |
set { _width = value; } |
} |
#endregion |
protected override void OnInit(EventArgs e) |
{ |
base.OnInit(e); |
RadScriptManager scriptManager = new RadScriptManager(); |
Controls.Add(scriptManager); |
} |
protected override void CreateChildControls() |
{ |
RadAjaxManager radAjaxManager = new RadAjaxManager(); |
AjaxSetting ajaxSetting = new AjaxSetting(); |
ajaxSetting.AjaxControlID = "button1"; |
AjaxUpdatedControl ajaxUpdatedControl = new AjaxUpdatedControl(); |
ajaxUpdatedControl.ControlID = "simplePanel"; |
ajaxUpdatedControl.LoadingPanelID = "ajaxLoadingPanel"; |
ajaxSetting.UpdatedControls.Add(ajaxUpdatedControl); |
radAjaxManager.AjaxSettings.Add(ajaxSetting); |
Controls.Add(radAjaxManager); |
RadAjaxLoadingPanel radAjaxLoadingPanel = new RadAjaxLoadingPanel(); |
radAjaxLoadingPanel.ID = "ajaxLoadingPanel"; |
Controls.Add(radAjaxLoadingPanel); |
Panel simplePanel = new Panel(); |
simplePanel.ID = "simplePanel"; |
simplePanel.Width = _width; |
simplePanel.Attributes.Add("style", "padding:50px;height:300px;"); |
Label lblTest1 = new Label(); |
lblTest1.Text = "Panel 1"; |
simplePanel.Controls.Add(lblTest1); |
simplePanel.Controls.Add(new LiteralControl("<br /><br />")); |
Button button1 = new Button(); |
button1.ID = "button1"; |
button1.Text = "Press Me"; |
button1.Click += new EventHandler(button1_Click); |
simplePanel.Controls.Add(button1); |
Controls.Add(simplePanel); |
} |
void button1_Click(object sender, EventArgs e) |
{ |
System.Threading.Thread.Sleep(2000); |
} |
} |
} |
Joshua