<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestListBox.WebForm1" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><!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 runat="server"></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="scrpMngr" runat="server" AsyncPostBackTimeout="600"> </telerik:RadScriptManager> <div> <telerik:RadWindow runat="server" ID="rdwWin" Height="320" Width="515" Behaviors="Close" Overlay="true" Modal="true" VisibleStatusbar="false" VisibleOnPageLoad="false" Visible="false"> <ContentTemplate> <telerik:RadListBox runat="server" ID="lbSource" Height="200px" Width="260px" AllowTransfer="true" TransferToID="lbSelected" AllowTransferDuplicates="false" AllowTransferOnDoubleClick="true" TransferMode="Move" EnableDragAndDrop="true" ButtonSettings-Position="Right" TabIndex="1" AccessKey="y"> <EmptyMessageTemplate>No items found</EmptyMessageTemplate> </telerik:RadListBox> <telerik:RadListBox runat="server" ID="lbSelected" Height="200px" Width="230px" AllowTransferOnDoubleClick="true" EnableDragAndDrop="true"> <EmptyMessageTemplate>No items selected</EmptyMessageTemplate> </telerik:RadListBox> </ContentTemplate> </telerik:RadWindow> <asp:Button Text="Show window" runat="server" OnClick="btnShow_Click" /> </div> </form></body></html>namespace TestListBox { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lbSource.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Value = "1", Text = "some item" }); lbSource.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Value = "2", Text = "another item" }); } } protected void btnShow_Click(object sender, EventArgs e) { rdwWin.Visible = true; rdwWin.VisibleOnPageLoad = true; } }}Hi!
While I was converting some regular ASP code to use the Telerik controls, I found a problem with some of our pages. We have a header user control with a logout button, so I want to convert the button to be a Rad Image Button. When I add in a RadButton (or Rad anything) to the header, I get an error that says “The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)“ for some of the pages. I found that it seems to be unhappy with the <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> line, or anything that tries to add Telerik controls to the user control. Does anyone have any idea what could be causing this and how to fix it? I’d really like to be able to the Telerik image buttons throughout all of our code. Thanks!
Holly
<telerik:RadNotification ID="RadNotification1" runat="server" Width="320" Animation="Fade" EnableRoundedCorners="true" Skin="Windows7" EnableShadow="true" Style="z-index: 35000" LoadContentOn="TimeInterval" OffsetX="-20" OffsetY="-20" VisibleTitlebar="true" WcfRequestMethod="POST" WcfServicePath="~/Service References/ProcessLogServiceRef/Reference.svcmap" WcfServiceMethod="GetLogData" UpdateInterval="5000" OnClientUpdating="RadNotificationUpdating"></telerik:RadNotification><telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function RadNotificationUpdating(sender, args) { //alert('Hallo'); } </script></telerik:RadScriptBlock>using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.Text;using System.ServiceModel.Activation;namespace YBS.Services.SYS{ // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ProcessLog" in both code and config file together. [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ProcessLog : IProcessLog { public void GetLogData(string sTimeStamp) { } }}<script type="text/javascript"> function doTweet(sender, args) { alert("hey! " + args.get_url()); }</script>[...]<telerik:RadSocialShare ID="RadSocialShare1" OnTweet="doTweet" runat="server"></telerik:RadSocialShare>RadSocialShare1.MainButtons.Clear();RadSocialShare1.CompactButtons.Clear();[...]RadTwitterButton rsbTW = new RadTwitterButton();rsbTW.TitleToShare = strTitleToShare;rsbTW.UrlToShare = strUrlTW; //BitlyApi.ShortenUrl(RadSocialShare1.MainButtons.Add(rsbTW);