Answer the question
In order to leave comments, you need to log in
How to declare variables correctly so that there is no error?
Have a nice day, everyone!
Created a user control for an asp.net webforms application. It works, but an error is displayed in the studio - how do I correctly declare variables so that this error does not occur?
The essence of the error screen
[ParseChildren(true, "Content")]
[PersistChildren(true)]
public partial class Controls_Popup : System.Web.UI.UserControl
{
public string ppId;
private Control _content;
private Control _footer;
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Control Content
{
get { return _content; }
set { _content = value; }
}
public Control Footer
{
get {
if (_footer == null)
{
_footer = new Control();
}
return _footer; }
set { _footer = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
ppContent.Controls.Add((Control)_content);
ppFooter.Controls.Add((Control)_content);
}
}
<div id="<%=ppId%>" class="popup" style="display:none">
<div class="popup-content" style="width:300px">
<div class="popup-btn-close" onclick="ShowPP('<%=ppId%>');">
<img height="24" alt="" src="../../Style/img/IconGrey24DeleteLight.png" />
</div>
<div id="ppContent" runat="server" class="popup-content-2">
</div>
<div id="ppFooter" runat="server" class="popup-func-btns">
</div>
</div>
<div class="popup-bg" onclick="ShowPP('<%=ppId%>');"></div>
</div>
Answer the question
In order to leave comments, you need to log in
Have you considered this example?
https://stackoverflow.com/a/3905584/2822609
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question