or
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="400px" Width="990px"> <telerik:RadGrid ID="DataGrid" runat="server" OnDeleteCommand="DataGrid_DeleteCommand" OnNeedDataSource="DataGrid_NeedDataSource" OnUpdateCommand="DataGrid_UpdateCommand" AllowPaging="True" AllowSorting="True" PageSize="20" GridLines="Horizontal" ShowFooter="True" ShowStatusBar="True" Width="100%" CellSpacing="0" AutoGenerateColumns="False" onitemcommand="DataGrid_ItemCommand"> <MasterTableView DataKeyNames="id"> </MasterTableView> </telerik:RadGrid> </telerik:RadAjaxPanel>DataTable dtFields = DataManager.Instance.GetGridData(0, 1, this.module.DataObject, this.module.DataSource); foreach (DataColumn dc in dtFields.Columns) { if (dc.ColumnName == "id") continue; GridBoundColumn gbc = new GridBoundColumn(); gbc.HeaderText = dc.ColumnName; gbc.DataField = dc.ColumnName; this.DataGrid.MasterTableView.Columns.Add(gbc); }GridEditCommandColumn gecc = new GridEditCommandColumn();gecc.ButtonType = GridButtonColumnType.ImageButton;gecc.EditImageUrl = "~/Images/Icons/87._16x16.png";this.DataGrid.MasterTableView.Columns.Add(gecc);GridButtonColumn gbc = new GridButtonColumn();gbc.ButtonType = GridButtonColumnType.ImageButton;gbc.ImageUrl = "~/Images/Icons/7._16x16.png";gbc.CommandName = "Delete";gbc.ConfirmText = "Weet u zeker dat u dit item wilt verwijderen?";gbc.ConfirmDialogType = GridConfirmDialogType.RadWindow;gbc.ConfirmTitle = "Verwijderen";this.DataGrid.MasterTableView.Columns.Add(gbc);<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Test_RadComboBox.aspx.cs" Inherits="KR.IQ.Test_RadComboBox" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Page Title</title></head><body style="margin:0 auto;width:1000px;position:relative;"><!-- Provide the layout for all pages --> <form id="form1" runat="server"> <ajax:ToolkitScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" CombineScripts="false"></ajax:ToolkitScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="LoadingPanel1" /> <script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest); Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded); </script> <div id="container"> <div id="mainBody"> <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" EnableSkinTransparency="false"> <div class="ajaxLoadingDiv" style="width:200px;height:100px;background-color:white;position:absolute; border:1px solid #3AB2E6;" > <br /> <center><img src="/Images/Global/Ajax/ajax-loader.gif" alt="loading" /> <br /> <asp:Label runat="server" Text="Loading..." ID="lblProgressTemplateRAD"></asp:Label> </center> </div> </telerik:RadAjaxLoadingPanel> <div id="fi"> <telerik:RadComboBox ID="radComboBoxFIFilter" runat="server" Width="200px" AppendDataBoundItems="true" CssClass="floatRight"> <Items> <telerik:RadComboBoxItem Text="SHOW ALL" Value="ALL" /> </Items> </telerik:RadComboBox> </div> </div> </div></form></body></html>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace KR.IQ{ public partial class Test_RadComboBox : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { FillRadComboBox(); } /// <summary> /// Sets up the featured insights control with the filter, default content types and homepage tag /// </summary> private void FillRadComboBox() { List<KeyValuePair<string, string>> filterItemList = new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("One", "1"), new KeyValuePair<string, string>("Two", "2"), new KeyValuePair<string, string>("Three", "3") }; radComboBoxFIFilter.DataValueField = "key"; radComboBoxFIFilter.DataTextField = "value"; radComboBoxFIFilter.DataSource = filterItemList; radComboBoxFIFilter.DataBind(); } }}<telerik:GridGroupByField FieldName="INFO_GAME" FieldAlias="»" HeaderValueSeparator=" "> </telerik:GridGroupByField>DataBind and then I use the dropdownlist.Items.Insert(0,"Testing") doesn't show up in my DataGrid.EmployeeDetailsCS.ascx.cs in the
protected void EmployeeDetails_DataBinding(object sender, System.EventArgs e)
{
ArrayList tocs = new ArrayList(new string[] { "Dr.", "Mr.", "Mrs.", "Ms." });
ddlTOC.DataSource = tocs;
ddlTOC.DataBind();
//issue here
ddlTOC.Items.Insert(0,"Testing");
// or ddlTOC.Items.Insert(0,"Please select Title");
object tocValue = DataBinder.Eval(DataItem, "TitleOfCourtesy");
if (tocValue == DBNull.Value)
{
tocValue = "Mrs.";
}
ddlTOC.SelectedIndex = tocs.IndexOf((string)tocValue);
ddlTOC.DataSource = null;
}