This is a migrated thread and some comments may be shown as answers.

[Solved] ComboBox in the OnItemsRequested event, if the value of Text is Null, the error will be shown as shown in Fig.

3 Answers 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
ghd258 ghd258
Top achievements
Rank 1
ghd258 ghd258 asked on 27 Sep 2017, 03:17 AM

  protected override void OnInit(EventArgs e)
        {           
            rcbCustomer.HeaderTemplate = new HeaderTemplate();
            rcbCustomer.ItemTemplate = new HeaderItemTemplate();            
            base.OnInit(e);
        }

  public  class CustomerRCBTemplate
    {

    }
    public class HeaderTemplate : ITemplate
    {

        public void InstantiateIn(Control container)
        {

            HtmlTable table = new HtmlTable();

            HtmlTableRow row = new HtmlTableRow();

            HtmlTableCell cell = new HtmlTableCell();

            cell.InnerText = "客户编号";
            cell.Width = Unit.Pixel(100).ToString();
            row.Controls.Add(cell);

            HtmlTableCell cell1 = new HtmlTableCell();

            cell1.InnerText = "客户名称";
            cell1.Width = Unit.Pixel(160).ToString();
            row.Controls.Add(cell1);

            HtmlTableCell cell2 = new HtmlTableCell();

            cell2.InnerText = "主联系人";
            cell2.Width = Unit.Pixel(100).ToString();
            row.Controls.Add(cell2);

            HtmlTableCell cell3 = new HtmlTableCell();

            cell3.InnerText = "类型";
            cell3.Width = Unit.Pixel(100).ToString();
            row.Controls.Add(cell3);

            HtmlTableCell cell4 = new HtmlTableCell();

            cell4.InnerText = "商务人员";
            cell3.Width = Unit.Pixel(90).ToString();
            row.Controls.Add(cell4);

            table.Controls.Add(row);

            container.Controls.Add(table);


        }

    }

3 Answers, 1 is accepted

Sort by
0
ghd258 ghd258
Top achievements
Rank 1
answered on 27 Sep 2017, 03:27 AM
 <telerik:RadComboBox ID="rcbCustomer" runat="server" Width="100%" AllowCustomText="true"
                            Text="" OnClientItemsRequesting="ClientCustomerItemRequesting" HighlightTemplatedItems="true"
                            DropDownWidth="550px" ExpandAnimation-Duration="100" CollapseAnimation-Duration="100"
                            OnClientSelectedIndexChanged="OnClientSelectedIndexChangedCustomer" EnableLoadOnDemand="true"
                            AutoPostBack="true" OnItemsRequested="rcbCustomer_ItemsRequested" Height="200px">
                            <HeaderTemplate>
                                <ul class="Item">
                                    <li class="col2">客户名称</li>
                                    <li class="col3">主联系人</li>
                                    <li class="col4">客户类型</li>
                                </ul>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <ul class="Item">
                                    <li class="col2">
                                        <%# Healthway.Framework.Utilities.String.StringHelper.InternalHtmlEncode(DataBinder.Eval(Container, "Attributes[\"CusName\"]").ToString())%>
                                    </li>
                                    <li class="col3">
                                        <%# Healthway.Framework.Utilities.String.StringHelper.InternalHtmlEncode(DataBinder.Eval(Container, "Attributes[\"LinkmanName\"]").ToString())%>
                                    </li>
                                    <li class="col4">
                                        <%# Healthway.Framework.Utilities.String.StringHelper.InternalHtmlEncode(DataBinder.Eval(Container, "Attributes[\"CusTypeName\"]").ToString())%>
                                    </li>
                                </ul>
                            </ItemTemplate>
                            <FooterTemplate>
                                <div>
                                    <b>更多请输入助记码查询.</b>
                                </div>
                            </FooterTemplate>
                        </telerik:RadComboBox>
0
ghd258 ghd258
Top achievements
Rank 1
answered on 27 Sep 2017, 05:13 AM
&#25968;&#32452;&#19981;&#33021;&#20026;&#31354;&#12290;&#13;&#10;&#21442;&#25968;&#21517;: bytes
0
ghd258 ghd258
Top achievements
Rank 1
answered on 09 Oct 2017, 03:36 AM
Why don't you answer?
Tags
ComboBox
Asked by
ghd258 ghd258
Top achievements
Rank 1
Answers by
ghd258 ghd258
Top achievements
Rank 1
Share this question
or