我有一個頁面使用CustomerDetails.ascx
。它使用CM.ascx
。 CM.ascx
我使用AJAX Data Controls GridView與ID="gdvRecommendation"
。腳本控制不是註冊腳本控件
有時,當我瀏覽的網頁,我得到以下異常:
腳本控制「gdvRecommendation」不是一個註冊的腳本控制。在調用RegisterScriptDescriptors()之前,必須使用RegisterScriptControl()註冊腳本控件。
參數名:ScriptControl的
- 我的ScriptManager內容佔位符之前在母版頁中定義。
- 這種例外並不總是發生。
- 我在其他頁面使用
CustomerDetails.ascx
用戶控件,它的效果很好。
任何人都可以解釋我的問題,什麼是解決方案?
編輯:
這裏是CM.ascx
GridView的用法:
<td valign="top" style="height: 150px;">
<div id="divCMMessage"></div>
<div id='divRecommendation' style="width: 100%; display: inline; overflow: auto;">
<ADC:GridView ID="gdvRecommendation" Width="100%" runat="server" CellSpacing="0" CellPadding="3" HorizontalAlign="Right" ShowHeader="false" RowDataBoundEvent="onRowDataBound_gdvRecommendation">
<RowStyle Height="20px" />
<EmptyDataTemplate>no recommendations</EmptyDataTemplate>
<EmptyDataRowStyle HorizontalAlign="Right" BorderWidth="0" />
<Columns>
<ADC:GridViewImageColumn DataImageUrlField="IndImageUrl" HeaderText="" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="Center"></ADC:GridViewImageColumn>
<ADC:GridViewTemplateColumn HeaderText="">
<ItemTemplate>
<asp:Label ID="TreatName" runat="server" Text=""></asp:Label>
</ItemTemplate>
</ADC:GridViewTemplateColumn>
<ADC:GridViewTemplateColumn HeaderText="">
<ItemTemplate>
<asp:Label ID="TreatType" runat="server" Text=""></asp:Label>
</ItemTemplate>
</ADC:GridViewTemplateColumn>
</Columns>
</ADC:GridView>
</div>
</td>
的CustomerDetails.ascx
是一個多視圖(上MyPage.aspx)的內部。
你什麼時候得到這個錯誤信息?當您嘗試添加新控件或嘗試更新控件內容時?是否將控件放置在`UpdatePanel`中? – 2011-12-15 08:57:30
@Venkatarajan Arthanari:我加載MyPage.aspx時得到這個服務器異常。我直接在ascx文件中添加這個用戶控件。我不添加任何更新面板。請參閱編輯。 – Naor 2011-12-15 09:09:48
不確定以下鏈接是否會對您有所幫助,但它看起來像是針對同一問題的解決方案。 http://nwije.blogspot.com/2011/04/script-control-controlname-is-not.html – 2011-12-15 09:15:21