1
主頁
裏面我有一個用戶控制不能訪問用戶控件的屬性
public partial class ConLib_Custom_ClickAndCollect : System.Web.UI.UserControl
{
public string Address
{
get
{
if (ccTextBox.Text != String.Empty)
return ccTextBox.Text.ToString();
else
return "United Kingdom";
}
}
private Address _clickCollectAddress;
public Address ClickCollectAddress
{
get
{
return _clickCollectAddress;
}
set
{
_clickCollectAddress = value;
}
}
}
,當我嘗試在另一個這樣的.ascx頁面使用此控件。
<uc:ClickAndCollect ID="ClickAndCollectPanel" runat="server" Visible="false"
EnableViewState="true" />
而在後面的代碼中,我只能看到地址屬性而不是ClickCollectAddress屬性。
ClickAndCollectPanel.Address // and can not see this ClickAndCollectPanel.ClickCollectAddress
我不知道是什麼問題。
請大家幫忙。謝謝
您是否可以構建解決方案? –
是的......我想我已經找到了故障......地址是一個單獨的類,並且有一個屬性已經用Address聲明。所以我將它重命名爲Location ...並且它現在可以工作。 –