Telerik ASP.NET AJAX - 使用动态创建的 Docks 进行 Ajax 更新标签
我尝试在动态创建的 RadDock 的关闭事件上更新一个简单的标签。 到目前为止工作正常,标签获取了正确的值但没有更新它。
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;
}
我尝试这样做:
RadAjaxManager1.AjaxSettings.AddAjaxSetting(dock, Status, null);
在创建码头时,但在运行时我收到 NullReference 异常。
在使用 RadAjaxManager 注册的按钮上,它可以显示值 由dock_command分配。
protected void Button1_Click(object sender, EventArgs e)
{
Status.Text = Status.Text;
}
更新:RadAjaxManager 是使用 VS2008 的集成 Wizzard 创建的。 无法选择 Dock,因为它们是在运行时生成的。 在后端,它包含在自动完成中,因此 NullReference 无关 与 AjaxManager 本身。就像我说的,与按钮配合得很好。
<telerik:RadAjaxManager ID="RadAjaxManager1">
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Label1"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Telerik 支持人员在此解决了问题
http://www.telerik.com/community/forums/aspnet-ajax/docking/telerik-asp-net-ajax-ajax-update-label-with-dynamically -创建-docks.aspx
Questions was solved by Telerik Support here
http://www.telerik.com/community/forums/aspnet-ajax/docking/telerik-asp-net-ajax-ajax-update-label-with-dynamically-created-docks.aspx