我的代碼如下。無法更新用戶控件ASP.net更新面板中的標籤
<div class="table">
<asp:UpdatePanel runat="server" ID="labelPanel" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Label Text="" runat="server" ID="Cost"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<uc1:ucPartsListing ID="ucPartsListing" runat="server" />
</div>
現在用戶控件ucPartsListing本身具有2個更新面板。在某些情況下,從用戶控件觸發到父aspx的事件。
在這種情況下,我試圖設置aspx文件中存在的標籤值。我從代碼隱藏手動調用更新。 但它不起作用。我哪裏錯了?
public partial class PartsEnquiry : BaseAuthPage
{
protected void Page_Load(object sender, EventArgs e)
{
ucPartsListing.OnQuotePartsItemSelect += new ascx.ucPartsListing.QuotePartsItemEventHandler(ucPartsListing_OnQuotePartsItemSelect);
}
void ucPartsListing_OnQuotePartsItemSelect(string price)
{
Cost.Text = price; //This is not working !
labelPanel.Update();
}
嘗試設置div來的Runat =「服務器」 – leonsas 2012-08-15 02:53:53
你是不是想改變'ucPartsListing'用戶控件內從一個UpdatePanel在'Cost'標籤的文本? – user1429080 2012-08-15 04:26:47
@ user1429080 - 是的! – GuruC 2012-08-15 04:48:55