SORU
22 NİSAN 2009, ÇARŞAMBA


&; Denetimleri koleksiyonu edemiyor kontrol kod blokları" içerdiğinden değiştirilmesi"

Bir kaydırıcı basit bir kullanıcı denetimi oluşturmak için çalışıyorum. Bu kullanıcı denetimi için AjaxToolkit bir SliderExtender eklediğimde (*&$#()@# hata:

    Server Error in '/' Application. The Controls collection cannot be modified because the control contains code blocks (i.e. ``). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. ``).

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. ``).]    System.Web.UI.ControlCollection.Add(Control child)  8677431    AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:293 AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:306 System.Web.UI.Control.LoadRecursive()
     50    System.Web.UI.Control.LoadRecursive()
     141    System.Web.UI.Control.LoadRecursive()
     141    System.Web.UI.Control.LoadRecursive()
     141    System.Web.UI.Control.LoadRecursive()             
     141    System.Web.UI.Control.LoadRecursive()
     141    System.Web.UI.Control.LoadRecursive()
     141    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  627


    Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074

Kullanıcı denetimi için bir yer tutucu koymak ve yer tutucu metin kutusu ve kaydırıcı extender Program aracılığıyla ekleme denedim ve ben hala hata alıyorum.

Burada basit bir kod:

<table cellpadding="0" cellspacing="0" style="width:100%">
    <tbody>
        <tr>
            <td></td>
            <td>
                <asp:Label ID="lblMaxValue" runat="server" Text="Maximum" CssClass="float_right" />
                <asp:Label ID="lblMinValue" runat="server" Text="Minimum" />
            </td>
        </tr>
        <tr>
            <td style="width:60%;">
                <asp:CheckBox ID="chkOn" runat="server" /><asp:Label ID="lblPrefix" runat="server" />: <asp:Label ID="lblSliderValue" runat="server" /> <asp:Label ID="lblSuffix" runat="server" />
            </td>
            <td style="text-align:right;width:40%;">                

                    <asp:TextBox ID="txtSlider" runat="server" Text="50" style="display:none;" />
                    <ajaxToolkit:SliderExtender ID="seSlider" runat="server" 
                        BehaviorID="seSlider" 
                        TargetControlID="txtSlider" 
                        BoundControlID="lblSliderValue" 
                        Orientation="Horizontal" 
                        EnableHandleAnimation="true" 
                        Length="200" 
                        Minimum="0" 
                        Maximum="100" 
                        Steps="1" />

            </td>
        </tr>
    </tbody>
</table>

Sorun nedir?

CEVAP
24 Temmuz 2009, Cuma


İlk kod bloğu ile < başlatın%# yerine <=%:

<head id="head1" runat="server">
  <title>My Page</title>
  <link href="css/common.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="<%# ResolveUrl("~/javascript/leesUtils.js") %>"></script>
</head>

Bu bir karşılık gelen kod bloğunu değiştirir.Bir veri bağlama ifadesi için kod bloğu yazın.
<%# ... %> veri bağlama ifadeleri blok kodu olmadığı için, CLR demesin. Ana sayfa kodunda, aşağıdaki eklemek istiyorum:

protected void Page_Load(object sender, EventArgs e)
{
  Page.Header.DataBind();    
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Android Central

    Android Cent

    13 Kasım 2008
  • Jaclyn W

    Jaclyn W

    5 Mayıs 2006
  • kimaliz

    kimaliz

    18 Temmuz 2006