radcombobox控件选择的值是空的 [英] RadComboBox selected value is empty

查看:1103
本文介绍了radcombobox控件选择的值是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的的SelectedValue =当我点击我的按钮。

I get the SelectedValue = "" when i click on My button .

我的aspx:

<telerik:RadComboBox ID="ddl_contactList" runat="server" AutoPostBack="True" CausesValidation="False"
            CollapseDelay="0" Culture="ar-EG" ExpandDelay="0" Filter="StartsWith" ItemsPerRequest="10"
            MarkFirstMatch="true" Skin="Outlook" EnableAutomaticLoadOnDemand="True" EmptyMessage="-New Menu-"
            ShowMoreResultsBox="True" OnSelectedIndexChanged="ddl_contactList_SelectedIndexChanged"
            EnableItemCaching="false" EnableLoadOnDemand="True" EnableVirtualScrolling="True">
        </telerik:RadComboBox>


我的.cs:

 private void BindContactLists(int year, int main_code)
        {
            ddl_contactList.Items.Clear();
            DataTable dt = ContactList.GetContactListsByDep(year, main_code);
            ddl_contactList.DataSource = dt;
            ddl_contactList.DataTextField = "list_desc";
            ddl_contactList.DataValueField = "list_code";
            ddl_contactList.DataBind();

        }


我把它在页面加载,因为当我把它在
Page.Ispostback ,我收到以下错误:


I call it in the page load because when I call it in the !Page.Ispostback, I get the following error:

有没有指定的数据源。无法完成回调的要求。

There is no assigned data source. Unable to complete callback request.

我怎样才能解决这个问题呢?现在:

How can I fix this problem? Right now:

ddl_contactList.Text ==MySelectedItemText

了selectedValue ==将selectedItem ==

推荐答案

将您的来电 BindContactLists()的Page_Load()方法的 Page_Init()方法。这允许控制是用于设置在ViewState的页面生命周期后期绑定,并允许SelectedValue属性的适当的人口。

Move your call to BindContactLists() from the Page_Load() method to the Page_Init() method. This allows the control to be setup for ViewState binding later in the page lifecycle, and allow proper population of the SelectedValue property.

这篇关于radcombobox控件选择的值是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆