User controls causing a StackOverflowException in visual studio [c#]

frewfrux

Newcomer
Joined
Nov 15, 2005
Messages
8
Here's the situation...

I have web user control (.ascx) that has some properties I would like to define when the user control is added to the form. Currently I am under the impression that the code (c#) in the user control should be:

public string name
{
get
{
return name;
}
set
{
name = value;
}
}

and then in the web form's asp.net code I set the name when I declare the user control:

<uc1:WebUserControl1 id="WebUserControl11" name="testing" runat="server"></uc1:WebUserControl1>

If I don't declare the name there then it all works fine (except I have an unnamed control)

Can anyone see what I'm doing wrong?
 
Ok, so to answer my own question for the benifit of anyone else who may want to know, the c# code needed to be:

private string _name = "";
public string name
{
get
{
return _name;
}
set
{
_name = value;
}
}

and then assign a value by going:

_name = this.name;

Problem solved (2.5 hours...but solved none the less).

Now, how can I...hmmmmmmmmmmmm
 
Back
Top