Telerik ASP.NET AJAX - Ajax Update Label with dynamic created Docks

Posted by csharpnoob on Stack Overflow See other posts from Stack Overflow or by csharpnoob
Published on 2010-03-18T15:33:40Z Indexed on 2010/03/18 20:41 UTC
Read the original article Hit count: 1104

Filed under:
|
|
|
|

Hi,

i try to Update a simple Label on Close Event of dynamic created RadDock. Works fine so far, Label gets the correct values but doesnt updates it.

   RadDock dock = new RadDock();
            dock.DockMode = DockMode.Docked;
            dock.UniqueName = Guid.NewGuid().ToString();
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);
            dock.Title = slide.slideName;
            dock.Text = string.Format("Added at {0}", DateTime.Now);
            dock.Width = Unit.Pixel(300);
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack = true;
        dock.Command += new DockCommandEventHandler(dock_Command);

...

void dock_Command(object sender, DockCommandEventArgs e)
{
Status.Text = "Removed " + ((RadDock)sender).Title + " " + ((RadDock)sender).Text;
}

I tried to do this:

RadAjaxManager1.AjaxSettings.AddAjaxSetting(dock, Status, null);

while creating the docks, but on runtime i get a NullReference Excepetion.

On a Button registered with the RadAjaxManager it works to show the value assigned by dock_command.

    protected void Button1_Click(object sender, EventArgs e)
    {
        Status.Text = Status.Text;
    }

UPDATE: The RadAjaxManager was created with integrated Wizzard of VS2008. Can't select the Docks, because the are generated while runtime. On Backend its included in AutoCompletion, so the NullReference has nothing to do with the AjaxManager itself. Like i said, works fine with the Button.

<telerik:RadAjaxManager ID="RadAjaxManager1">
       <telerik:AjaxSetting AjaxControlID="Button1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Label1"></telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>

© Stack Overflow or respective owner

Related posts about telerik

Related posts about dock