C
Cristian Ionita
I need to be able to set a string property in a control to an empty string
using the properties window.
The problem is that when I set the property to an empty string, Visual
Studio
serializes the property in aspx as:
<cc1:VerySimpleControl id="Vvsc" runat="server" MyString="
"></cc1:VerySimpleControl>
(MyString property contains one space)
instead of:
<cc1:VerySimpleControl id="Vvsc" runat="server"
MyString=""></cc1:VerySimpleControl>
(no spaces)
Is there any workaround for this issue in Visual Studio?
Here is the code for the test control:
public class VerySimpleControl : WebControl
{
public VerySimpleControl()
{
myString = "NotSet";
}
private string myString;
[DefaultValue("NotSet")]
public string MyString
{
get { return myString; }
set { myString = value; }
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.Write(
"String: '{0}' Length: {1}",
MyString, MyString.Length);
base.RenderContents (writer);
}
}
Cristian Ionita
Regisco S.A.
using the properties window.
The problem is that when I set the property to an empty string, Visual
Studio
serializes the property in aspx as:
<cc1:VerySimpleControl id="Vvsc" runat="server" MyString="
"></cc1:VerySimpleControl>
(MyString property contains one space)
instead of:
<cc1:VerySimpleControl id="Vvsc" runat="server"
MyString=""></cc1:VerySimpleControl>
(no spaces)
Is there any workaround for this issue in Visual Studio?
Here is the code for the test control:
public class VerySimpleControl : WebControl
{
public VerySimpleControl()
{
myString = "NotSet";
}
private string myString;
[DefaultValue("NotSet")]
public string MyString
{
get { return myString; }
set { myString = value; }
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.Write(
"String: '{0}' Length: {1}",
MyString, MyString.Length);
base.RenderContents (writer);
}
}
Cristian Ionita
Regisco S.A.