or
<table style="width: 662px;padding:0px;margin:0px"> <tr> <td style="width: 102px;padding:0px;margin:0px;"> <asp:Label ID="Label3" runat="server" Text="Tipo alloggiato:" Width="102px"></asp:Label> </td> <td style="width: 150px;padding:0px;margin:0px;"> <telerik:RadComboBox ID="tipoalloggiato" Runat="server" Culture="it-IT" Skin="Silk" Width="130px"> <Items> <telerik:RadComboBoxItem runat="server" Text="Ospite singolo" Value="16" /> <telerik:RadComboBoxItem runat="server" Text="Capo famiglia" Value="17" /> <telerik:RadComboBoxItem runat="server" Text="Capo gruppo" Value="18" /> </Items> </telerik:RadComboBox> </td> <td style="width: 105px;padding:0px;margin:0px"> <asp:Label ID="Label4" runat="server" Text="nr. componenti:" Width="105px"></asp:Label> </td> <td style="width: 70px;padding:0px;margin:0px"> <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server" Culture="it-IT" DbValueFactor="1" LabelWidth="0px" Skin="Silk" Value="1" Width="50px" DataType="System.Int32" MaxLength="4"> <NumberFormat ZeroPattern="n" DecimalDigits="0" DecimalSeparator="."></NumberFormat> <DisabledStyle Font-Underline="False" HorizontalAlign="Right" /> </telerik:RadNumericTextBox> </td> <td style="width: 85px;padding:0px;margin:0px"> <asp:Label ID="Label5" runat="server" Text="Tipo gruppo:" Width="85px"></asp:Label> </td> <td style="width: 160px;padding:0px;margin:0px"> <telerik:RadComboBox ID="tipogruppo" Runat="server" Skin="Silk"> </telerik:RadComboBox> </td> </tr> </table>IEnumerable<string> AdditionalCategoryTypes = LoadAdditionalCategoryTypes(thisObj.ProductID);foreach (string val in AdditionalCategoryTypes){ if (ddAdditionalCategoryTypes.Items.FindItemByValue(val) != null) ddAdditionalCategoryTypes.Items.FindItemByValue(val).Checked = true;}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SampleWebPage.aspx.cs" Inherits="CMMS.SampleWebPage" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title></title></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> <telerik:RadSkinManager ID="RadSkinManager" runat="server" Skin="Hay" /> <telerik:RadAjaxManager ID="ctl00_ajaxManager" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="pnlProducts"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadInputManager_TemplateControls" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="pnlOthers"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadInputManager1" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <div> <telerik:RadAjaxLoadingPanel ID="ajaxloading" runat="server" IsSticky="true" Transparency="20" Skin=""> </telerik:RadAjaxLoadingPanel> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="ajaxloading"> <asp:Panel ID="pnlOthers" runat="server"> <table> <tr> <td>Host Code: </td> <td> <asp:TextBox ID="txtHostCode" runat="server" Width="300" ValidationGroup="gp1" /> </td> </tr> <tr> <td>Host Name: </td> <td> <asp:TextBox ID="txtHostName" runat="server" Width="300" ValidationGroup="gp1" /> </td> </tr> </table> </asp:Panel> <br /> <asp:Panel ID="pnlProducts" runat="server"> <telerik:RadListView ID="lvProducts" runat="server" ItemPlaceholderID="ProductsContainer" DataKeyNames="ID" AllowPaging="true" Width="500" OnItemCreated="lvProducts_ItemCreated" OnNeedDataSource="lvProducts_NeedDataSource" OnItemCommand="lvProducts_ItemCommand"> <LayoutTemplate> <fieldset> <legend>Products and Services </legend> <asp:PlaceHolder ID="ProductsContainer" runat="server"></asp:PlaceHolder> <div style="clear: both" /> <div> <telerik:RadButton ID="btnInitInsert" runat="server" Text="Insert new product" CommandName="<%# RadListView.InitInsertCommandName %>" ButtonType="LinkButton" OnClick="btnProductInitInsert_Click" /> </div> </table> </fieldset> </LayoutTemplate> <ItemTemplate> <fieldset> <table> <tr> <td style="width: 100px;">Product Code: </td> <td> <%#Eval("Code")%> </td> </tr> <tr> <td>Product Name: </td> <td> <%#Eval("Name") %> </td> </tr> <tr> <td>Description: </td> <td> <%# Eval("Description")%> </td> </tr> <tr> <td>Tags: </td> <td> <asp:Label ID="lblTagString" runat="server" Visible="false" Text='<%#Bind("TagString")%>' /> <telerik:RadAutoCompleteBox ID="racTag" runat="server" AllowCustomEntry="true" InputType="Token" Width="607" Enabled="false"> </telerik:RadAutoCompleteBox> </td> </tr> </table> </fieldset> </ItemTemplate> <InsertItemTemplate> <fieldset> <legend>New Product </legend> <table> <tr> <td style="width: 100px">Code<b style="color: Red">*</b>: </td> <td> <asp:TextBox ID="txtCode" runat="server" Text='<%# Bind("Code") %>' Width="300px" ValidationGroup="gp2"></asp:TextBox> </td> </tr> <tr> <td>Name<b style="color: Red">*</b>: </td> <td> <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>' Width="300px" ValidationGroup="gp2"></asp:TextBox> </td> </tr> <tr> <td>Description<b style="color: Red">*</b>: </td> <td> <asp:TextBox ID="txtDescription" runat="server" Text='<%#Bind("Description")%>' ValidationGroup="gp2" Width="500px" Height="60" TextMode="MultiLine" /> </td> </tr> <tr> <td>Tags: </td> <td> <telerik:RadAutoCompleteBox ID="racTag" runat="server" AllowCustomEntry="true" EmptyMessage="Enter tag names separated by semicolon ( ; )" InputType="Token" Width="507" DropDownWidth="300" DataTextField="tag_value" DataValueField="ID"> </telerik:RadAutoCompleteBox> </td> </tr> <tr> <td colspan="2"> <br /> </td> </tr> <tr> <td style="text-align: right;" colspan="2"> <telerik:RadButton ID="btnPerformInsert" runat="server" Text="Insert" CommandName="<%# RadListView.PerformInsertCommandName %>" Width="70" ButtonType="LinkButton" CausesValidation="true" ValidationGroup="gp2" /> <telerik:RadButton ID="btnCancel" runat="server" Text="Cancel" CommandName="<%# RadListView.CancelCommandName %>" CausesValidation="false" Width="70" ButtonType="LinkButton" /> </td> </tr> </table> </fieldset> </InsertItemTemplate> <EmptyDataTemplate> <fieldset> <legend>Products and Services </legend> <fieldset> No data to display! </fieldset> <telerik:RadButton ID="btnInitInsert" runat="server" Text="Insert new product" OnClick="btnProductInitInsert_Click" CommandName="<%# RadListView.InitInsertCommandName %>" ButtonType="LinkButton" /> </fieldset> </EmptyDataTemplate> </telerik:RadListView> </asp:Panel> </telerik:RadAjaxPanel> <telerik:RadInputManager runat="server" ID="RadInputManager1"> <telerik:TextBoxSetting BehaviorID="txtbeh" InitializeOnClient="true" ErrorMessage="Required field!" Validation-ValidationGroup="gp1" Validation-IsRequired="true"> <TargetControls> <telerik:TargetInput ControlID="txtHostCode" /> <telerik:TargetInput ControlID="txtHostName" /> </TargetControls> </telerik:TextBoxSetting> </telerik:RadInputManager> <telerik:RadInputManager runat="server" ID="RadInputManager_TemplateControls"> <telerik:TextBoxSetting BehaviorID="txtbeh2" InitializeOnClient="true" ErrorMessage="Required field!" Validation-ValidationGroup="gp2" Validation-IsRequired="true"> </telerik:TextBoxSetting> </telerik:RadInputManager> </div> </form></body></html>using System;using System.Collections.Generic;using System.Data;using System.Globalization;using System.IO;using System.Linq;using System.Threading;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;namespace CMMS{ public partial class SampleWebPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadProductListView(); lvProducts.DataBind(); } } private void LoadProductListView() { lvProducts.DataSource = GetSampleData(); } private DataTable GetSampleData() { DataTable l_Table = new DataTable("Sample"); l_Table.Columns.Add("ID"); l_Table.Columns.Add("Code"); l_Table.Columns.Add("Name"); l_Table.Columns.Add("Description"); l_Table.Columns.Add("TagString"); //l_Table.Rows.Add(new string[] { "1", "Code1", "Name1", "Description1", "" }); //l_Table.Rows.Add(new string[] { "2", "Code2", "Name2", "Description2", "" }); //l_Table.Rows.Add(new string[] { "3", "Code3", "Name3", "Description3", "" }); return l_Table; } protected void btnProductInitInsert_Click(object sender, System.EventArgs e) { lvProducts.ShowInsertItem(); lvProducts.FindControl("btnInitInsert").Visible = false; } protected void lvProducts_ItemCommand(object sender, RadListViewCommandEventArgs e) { if (e.CommandName == RadListView.CancelCommandName) { HideProductInsertItemTemplate(); } } private void HideProductInsertItemTemplate() { lvProducts.InsertItemPosition = RadListViewInsertItemPosition.None; lvProducts.FindControl("btnInitInsert").Visible = true; } protected void lvProducts_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e) { LoadProductListView(); } protected void lvProducts_ItemCreated(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewInsertItem && e.Item.IsInEditMode) { TextBox l_Code = e.Item.FindControl("txtCode") as TextBox; TextBox l_Name = e.Item.FindControl("txtName") as TextBox; TextBox l_Desc = e.Item.FindControl("txtDescription") as TextBox; TextBoxSetting l_textboxSetting = (TextBoxSetting)RadInputManager_TemplateControls.GetSettingByBehaviorID("txtbeh2"); l_textboxSetting.TargetControls.Add(new TargetInput(l_Code.UniqueID, true)); l_textboxSetting.TargetControls.Add(new TargetInput(l_Name.UniqueID, true)); l_textboxSetting.TargetControls.Add(new TargetInput(l_Desc.UniqueID, true)); } if (e.Item.FindControl("racTag") != null) { RadAutoCompleteBox l_AutoCompleteBox = e.Item.FindControl("racTag") as RadAutoCompleteBox; l_AutoCompleteBox.DataTextField = "tag_value"; l_AutoCompleteBox.DataValueField = "ID"; l_AutoCompleteBox.DataSource = GetSampleTagData(); l_AutoCompleteBox.DataBind(); } } private object GetSampleTagData() { DataTable l_Table = new DataTable("SampleTagTable"); l_Table.Columns.Add("ID"); l_Table.Columns.Add("tag_value"); l_Table.Rows.Add(new string[] { "1", "Clothing" }); l_Table.Rows.Add(new string[] { "2", "Shoes" }); l_Table.Rows.Add(new string[] { "3", "Sunglasses" }); l_Table.Rows.Add(new string[] { "4", "Watches" }); l_Table.Rows.Add(new string[] { "5", "Books" }); return l_Table; } }}