更新 RadComboBox 中的数据列表

发布于 2024-09-05 07:15:45 字数 283 浏览 2 评论 0原文

所以我只是在网络应用程序中处理很多小事情,所以我正在检查各种东西,以确保我不会因为愚蠢的问题而破坏它。

在我的网络应用程序中的某个时刻(试图使其大部分保持异步),我必须更新 RadComboBox 中的列表,因为添加了一些内容。我只需要再次调用 RadComboBox.DataBind() 吗?由于我没有明确使用其数据源(我在使用字符串方式的手动插入中执行此操作)对象来插入我的新记录,我是否需要告诉它进行更新?当我调用 databind 时,列表似乎没有更新,所以我觉得我需要重新检查数据源中的条目或其他内容,

谢谢

So I'm just struggling with a lot of little things in the web app so I'm checking up with all kinds of stuff to make sure i'm not breaking it cause of stupid problems.

At some point in my web app (trying to keep it mostly Asynchronous) I have to update the list in my RadComboBox because something was added. Do I just need to call RadComboBox.DataBind() again? Since I don't explicitly use its datasource(I do it in the manual insert using a string fashion) object to insert my new record do I need to tell that to update? The list just doesn't seem to update when i just call databind so I feel like i need to have the datasource recheck for entries or SOMETHING

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撑一把青伞 2024-09-12 07:15:45

正式的方法是使用 NeedDataSource 事件来设置数据源。

当您想要重新绑定时,您所要做的就是调用 DataBind() 方法。

The formal way is to use the NeedDataSource event to setup your datasource.

When you want to rebind, all you have to do is call the DataBind() method.

我做我的改变 2024-09-12 07:15:45

我刚刚在我的应用程序中遇到了这个问题,我设法通过将组合框包装在更新面板中来解决它:

 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                    <telerik:RadComboBox
                     ID="txtSearch" runat="server"
                     Width="120px" Height="25px"
                     EmptyMessage="Type a Taxonomy"
                     ShowToggleImage="false"  ShowDropDownOnTextboxClick="false" AllowCustomText="true" MarkFirstMatch="true"
                     >
                 </telerik:RadComboBox>
                 </telerik:RadAjaxPanel>

并且也不要 4get 在 AJAX SCript 管理器中添加更新面板,如下所示;

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> 
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="txtSearch" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 

            </AjaxSettings>
        </telerik:RadAjaxManager>

为了进一步确保正确更新,因此每次将项目添加到绑定到 ComboBox 的源时,您都必须调用 DataBind();

上述方法使用 Ajax 更新控件,这意味着您不必进行整页回发...

我希望我能提供帮助。

I just have encountered that problem with my application and I managed to solve it by wrapping the Combobox in an update panel:

 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                    <telerik:RadComboBox
                     ID="txtSearch" runat="server"
                     Width="120px" Height="25px"
                     EmptyMessage="Type a Taxonomy"
                     ShowToggleImage="false"  ShowDropDownOnTextboxClick="false" AllowCustomText="true" MarkFirstMatch="true"
                     >
                 </telerik:RadComboBox>
                 </telerik:RadAjaxPanel>

and also dont 4get to add the Update Panel in the AJAX SCript manager as follows;

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> 
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="txtSearch" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 

            </AjaxSettings>
        </telerik:RadAjaxManager>

And to further make sure that things are updated right , so everytime an item is added to the Source that is bound to the ComboBox then u have to call DataBind();

The Above method update the control using Ajax which means u dont have to do full page post back...

I hope I could help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文