Seeing a public variable

J

jacquesvdz

Hi

Hope someone can help me with this.Working with C#.net 2003

With my html I wanna display the string _controlMessage that was set in
my code behind

#region Class Variables
public string _controlMessage = "testing message";
#endregion Class Variables

#region Properties
public string Message
{
get
{
return _controlMessage;
}
set
{
_controlMessage = value;
}
}
#endregion Properties





<BODY>
<script type="text/javascript">
var globalHTML;

Function popup(str)
{
globalHTML="<html><body><form><textarea>"+str
+"</textarea><br><input type='button' value='Close'"
+"onclick='self.close()'></form></body></html>";
window.open("javascript:blush:pener.globalHTML",
"myPopup",
"width=400,height=300").focus();
}
</script>

<a href="#"></TEXTAREA><IMG border="none"
onclick="popup(_controlMessage)" style="WIDTH: 24px; HEIGHT: 24px"
height="24"
src="../../Images/knowledgebase.gif" width="24"></a>
</BODY>
 
A

Aboulfazl Hadi

Hi
You can not use private variables in markup. code-behinds fields must
be protected or public(_mcontrolMessage), or you can use property
(ControlMessage) instead.

tnx
A.Hadi
 
J

Joanna Carter [TeamB]

"Aboulfazl Hadi" <[email protected]> a écrit dans le message de (e-mail address removed)...

| You can not use private variables in markup. code-behinds fields must
| be protected or public(_mcontrolMessage), or you can use property
| (ControlMessage) instead.

The OP's code showed _mcontrolMessage as being public not private. In this
case, I wonder why they declared a property as well :)

Joanna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top