Accessing members of a user control from the aspx page.

D

Dave

I am having a hell of a time getting this working. I have a huge aspx page
that is using a tab control and a multipage control. To make things easy on
myself I decided to have each tab be a separate Web User Control. When the
page loads, the user controls show up in the correct tabs, but I can't access
the data. I want to be able to populate a bunch of text boxes and labels
with data that I pull from a SQL db. I first tried to set the members as
public static, but that throws a runtime error in a hidden line. Now I am
exposing the members in the standard way with:

public string expTxtFirstName
{
set
{
txtFirstName.Text = value;
}
get
{
return txtFirstName.Text;
}
}


This is also throwing a runtime error saying Object reference not set to an
instance of an object for the first member it comes to (txtFirstName).

Here is the class & textbox declaration:
public class Customer : System.Web.UI.UserControl
{
protected internal System.Web.UI.WebControls.TextBox txtFirstName;

I even tried to have a function local to the Customer class that could set
those values, but it fails with the same error. I even tried making a new
ascx page and recreating the code there, but it does the same thing.

What am I screwing up?

Thanks

dave
 
A

Alvin Bruney [MVP]

the user control isn't part of the page which is why it has its own code
behind file. your best bet is to redesign this
 
D

Dave

I understand that a web user control has its own codebehind. Every class has
separate code. But that does not explain why the autosense will list the
functions or members that I expose but throw a runtime error.

When I set the textboxes to be static it throws this:
Compiler Error Message: CS0176: Static member
'CMAlite.Controls.Customer.txtFirstName' cannot be accessed with an instance
reference; qualify it with a type name instead.
Line 66: #line default
Line 67: #line hidden
Line 68: this.txtFirstName = __ctrl;
Line 69:
Line 70: #line 8 "http://localhost/CMAlite/Controls/customer.ascx"


Thats not even from my code and nobody so far has been able to explain to me
what I'm doing wrong.

Dave Coursey



Alvin Bruney said:
the user control isn't part of the page which is why it has its own code
behind file. your best bet is to redesign this

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
I am having a hell of a time getting this working. I have a huge aspx page
that is using a tab control and a multipage control. To make things easy
on
myself I decided to have each tab be a separate Web User Control. When
the
page loads, the user controls show up in the correct tabs, but I can't
access
the data. I want to be able to populate a bunch of text boxes and labels
with data that I pull from a SQL db. I first tried to set the members as
public static, but that throws a runtime error in a hidden line. Now I am
exposing the members in the standard way with:

public string expTxtFirstName
{
set
{
txtFirstName.Text = value;
}
get
{
return txtFirstName.Text;
}
}


This is also throwing a runtime error saying Object reference not set to
an
instance of an object for the first member it comes to (txtFirstName).

Here is the class & textbox declaration:
public class Customer : System.Web.UI.UserControl
{
protected internal System.Web.UI.WebControls.TextBox txtFirstName;

I even tried to have a function local to the Customer class that could set
those values, but it fails with the same error. I even tried making a
new
ascx page and recreating the code there, but it does the same thing.

What am I screwing up?

Thanks

dave
 
A

Alvin Bruney [MVP]

post a small sample which demonstrates the problem i will take a look
use this as a guide http://www.yoda.arachsys.com/csharp/complete.html

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
I understand that a web user control has its own codebehind. Every class
has
separate code. But that does not explain why the autosense will list the
functions or members that I expose but throw a runtime error.

When I set the textboxes to be static it throws this:
Compiler Error Message: CS0176: Static member
'CMAlite.Controls.Customer.txtFirstName' cannot be accessed with an
instance
reference; qualify it with a type name instead.
Line 66: #line default
Line 67: #line hidden
Line 68: this.txtFirstName = __ctrl;
Line 69:
Line 70: #line 8
"http://localhost/CMAlite/Controls/customer.ascx"


Thats not even from my code and nobody so far has been able to explain to
me
what I'm doing wrong.

Dave Coursey



Alvin Bruney said:
the user control isn't part of the page which is why it has its own code
behind file. your best bet is to redesign this

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
I am having a hell of a time getting this working. I have a huge aspx
page
that is using a tab control and a multipage control. To make things
easy
on
myself I decided to have each tab be a separate Web User Control. When
the
page loads, the user controls show up in the correct tabs, but I can't
access
the data. I want to be able to populate a bunch of text boxes and
labels
with data that I pull from a SQL db. I first tried to set the members
as
public static, but that throws a runtime error in a hidden line. Now I
am
exposing the members in the standard way with:

public string expTxtFirstName
{
set
{
txtFirstName.Text = value;
}
get
{
return txtFirstName.Text;
}
}


This is also throwing a runtime error saying Object reference not set
to
an
instance of an object for the first member it comes to (txtFirstName).

Here is the class & textbox declaration:
public class Customer : System.Web.UI.UserControl
{
protected internal System.Web.UI.WebControls.TextBox txtFirstName;

I even tried to have a function local to the Customer class that could
set
those values, but it fails with the same error. I even tried making a
new
ascx page and recreating the code there, but it does the same thing.

What am I screwing up?

Thanks

dave
 
R

Robert Koritnik

Remember that even not shown user controls get events like OnLoad... So
maybe if there are many user controls on your page, maybe it's not the
control in question that's making problems. Check the stack trace and see
which control and what method is producing an error.
 
D

Dave

post a small sample which demonstrates the problem i will take a look


Ok, I read your document and this is as short and sweet as I could get it.
It requires an .aspx page and an .ascx web user control. I'm leaving off the
html for the aspx and ascx pages because all you need to do is drop a textbox
on the control and drop the control on the page. At this point I think I
just have something fundamentally wrong, but I would like to find out why
this isn't "allowed".


..aspx code behind page


using System;
using TESTbug.Controls;

namespace TESTbug
{
/// <summary>
/// Summary description for cma.
/// </summary>
public class main : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TabStrip tabStrip;
protected Microsoft.Web.UI.WebControls.MultiPage multiPage;

private void Page_Load(object sender, System.EventArgs e)
{
control.txtFirstName.Text = "This won't work";
}


#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion

}
}




ascx page code behind

namespace TESTbug.Controls
{
using System;

/// <summary>
/// Summary description for customer.
/// </summary>
public class control : System.Web.UI.UserControl
{
public static System.Web.UI.WebControls.TextBox txtFirstName;

private void Page_Load(object sender, System.EventArgs e)
{
//nothing
}

#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion
}
}



Thank you for your help
dave
 
D

Dave

I thought of that, but when I look at the stack trace it lists every single
member that I made static as an error, not just the current member.
 
D

David A. Coursey

Ok, here you go.

aspx page:

<%@ Register TagPrefix="s2f" TagName="control" src="control.ascx" %>
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false"
Inherits="TESTbug.main" %>
<html>
<head>
<title>test</title>
</head>
<body>
<form id=mainForm method=post runat="server">
<s2f:control id="control" runat="server"></s2f:control>
</form>
</body>
</html>


ascx page


<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="control.ascx.cs" Inherits="TESTbug.Controls.control"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:textbox id="txtFirstName" runat="server"></asp:textbox>


Alvin Bruney said:
post the html please

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
Ok, I read your document and this is as short and sweet as I could get it.
It requires an .aspx page and an .ascx web user control. I'm leaving off
the
html for the aspx and ascx pages because all you need to do is drop a
textbox
on the control and drop the control on the page. At this point I think I
just have something fundamentally wrong, but I would like to find out why
this isn't "allowed".


.aspx code behind page


using System;
using TESTbug.Controls;

namespace TESTbug
{
/// <summary>
/// Summary description for cma.
/// </summary>
public class main : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TabStrip tabStrip;
protected Microsoft.Web.UI.WebControls.MultiPage multiPage;

private void Page_Load(object sender, System.EventArgs e)
{
control.txtFirstName.Text = "This won't work";
}


#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion

}
}




ascx page code behind

namespace TESTbug.Controls
{
using System;

/// <summary>
/// Summary description for customer.
/// </summary>
public class control : System.Web.UI.UserControl
{
public static System.Web.UI.WebControls.TextBox txtFirstName;

private void Page_Load(object sender, System.EventArgs e)
{
//nothing
}

#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion
}
}



Thank you for your help
dave
 
A

Alvin Bruney [MVP]

hmmm.................................................................................................................................................................................................................................

















































i'm looking into this. i can reproduce it. it appears to be a bug at first
glance. gimme a couple days on this.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
Ok, here you go.

aspx page:

<%@ Register TagPrefix="s2f" TagName="control" src="control.ascx" %>
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false"
Inherits="TESTbug.main" %>
<html>
<head>
<title>test</title>
</head>
<body>
<form id=mainForm method=post runat="server">
<s2f:control id="control" runat="server"></s2f:control>
</form>
</body>
</html>


ascx page


<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="control.ascx.cs" Inherits="TESTbug.Controls.control"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:textbox id="txtFirstName" runat="server"></asp:textbox>


Alvin Bruney said:
post the html please

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
post a small sample which demonstrates the problem i will take a look
use this as a guide http://www.yoda.arachsys.com/csharp/complete.html


Ok, I read your document and this is as short and sweet as I could get
it.
It requires an .aspx page and an .ascx web user control. I'm leaving
off
the
html for the aspx and ascx pages because all you need to do is drop a
textbox
on the control and drop the control on the page. At this point I
think I
just have something fundamentally wrong, but I would like to find out
why
this isn't "allowed".


.aspx code behind page


using System;
using TESTbug.Controls;

namespace TESTbug
{
/// <summary>
/// Summary description for cma.
/// </summary>
public class main : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TabStrip tabStrip;
protected Microsoft.Web.UI.WebControls.MultiPage multiPage;

private void Page_Load(object sender, System.EventArgs e)
{
control.txtFirstName.Text = "This won't work";
}


#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion

}
}




ascx page code behind

namespace TESTbug.Controls
{
using System;

/// <summary>
/// Summary description for customer.
/// </summary>
public class control : System.Web.UI.UserControl
{
public static System.Web.UI.WebControls.TextBox txtFirstName;

private void Page_Load(object sender, System.EventArgs e)
{
//nothing
}

#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion
}
}



Thank you for your help
dave
 
A

Alvin Bruney [MVP]

do you have this compiling. i swear mine compiled a while ago. now it will
not compile at this line
control.txtFirstName.Text = "This won't work";

rightfully stating that txtFirstName.Text is inaccessible.



check again to see if it compiles. if it does, zip the bare bones and send
it to me

(e-mail address removed)

i have a fix for it but it might be moot if it doesn't compile correctly
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
Ok, here you go.

aspx page:

<%@ Register TagPrefix="s2f" TagName="control" src="control.ascx" %>
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false"
Inherits="TESTbug.main" %>
<html>
<head>
<title>test</title>
</head>
<body>
<form id=mainForm method=post runat="server">
<s2f:control id="control" runat="server"></s2f:control>
</form>
</body>
</html>


ascx page


<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="control.ascx.cs" Inherits="TESTbug.Controls.control"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:textbox id="txtFirstName" runat="server"></asp:textbox>


Alvin Bruney said:
post the html please

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Dave said:
post a small sample which demonstrates the problem i will take a look
use this as a guide http://www.yoda.arachsys.com/csharp/complete.html


Ok, I read your document and this is as short and sweet as I could get
it.
It requires an .aspx page and an .ascx web user control. I'm leaving
off
the
html for the aspx and ascx pages because all you need to do is drop a
textbox
on the control and drop the control on the page. At this point I
think I
just have something fundamentally wrong, but I would like to find out
why
this isn't "allowed".


.aspx code behind page


using System;
using TESTbug.Controls;

namespace TESTbug
{
/// <summary>
/// Summary description for cma.
/// </summary>
public class main : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TabStrip tabStrip;
protected Microsoft.Web.UI.WebControls.MultiPage multiPage;

private void Page_Load(object sender, System.EventArgs e)
{
control.txtFirstName.Text = "This won't work";
}


#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion

}
}




ascx page code behind

namespace TESTbug.Controls
{
using System;

/// <summary>
/// Summary description for customer.
/// </summary>
public class control : System.Web.UI.UserControl
{
public static System.Web.UI.WebControls.TextBox txtFirstName;

private void Page_Load(object sender, System.EventArgs e)
{
//nothing
}

#region Web Form Designer generated code
//left out for clarity, nothing has been
altered
#endregion
}
}



Thank you for your help
dave
 
A

Alvin Bruney [MVP]

you've made the textbox a static instance. controls cannot be static because
it interfers with the viewstate mechanism. instead you should store the data
in a static variable. consider a get/set method to move the data in the
textbox into a static reference


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin Bruney said:
do you have this compiling. i swear mine compiled a while ago. now it will
not compile at this line
control.txtFirstName.Text = "This won't work";

rightfully stating that txtFirstName.Text is inaccessible.



check again to see if it compiles. if it does, zip the bare bones and send
it to me

(e-mail address removed)

i have a fix for it but it might be moot if it doesn't compile correctly
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
Ok, here you go.

aspx page:

<%@ Register TagPrefix="s2f" TagName="control" src="control.ascx" %>
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false"
Inherits="TESTbug.main" %>
<html>
<head>
<title>test</title>
</head>
<body>
<form id=mainForm method=post runat="server">
<s2f:control id="control" runat="server"></s2f:control>
</form>
</body>
</html>


ascx page


<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="control.ascx.cs" Inherits="TESTbug.Controls.control"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:textbox id="txtFirstName" runat="server"></asp:textbox>


Alvin Bruney said:
post the html please

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
post a small sample which demonstrates the problem i will take a look
use this as a guide http://www.yoda.arachsys.com/csharp/complete.html


Ok, I read your document and this is as short and sweet as I could get
it.
It requires an .aspx page and an .ascx web user control. I'm leaving
off
the
html for the aspx and ascx pages because all you need to do is drop a
textbox
on the control and drop the control on the page. At this point I
think I
just have something fundamentally wrong, but I would like to find out
why
this isn't "allowed".


.aspx code behind page


using System;
using TESTbug.Controls;

namespace TESTbug
{
/// <summary>
/// Summary description for cma.
/// </summary>
public class main : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TabStrip tabStrip;
protected Microsoft.Web.UI.WebControls.MultiPage multiPage;

private void Page_Load(object sender, System.EventArgs e)
{
control.txtFirstName.Text = "This won't work";
}


#region Web Form Designer generated code
//left out for clarity, nothing has
been
altered
#endregion

}
}




ascx page code behind

namespace TESTbug.Controls
{
using System;

/// <summary>
/// Summary description for customer.
/// </summary>
public class control : System.Web.UI.UserControl
{
public static System.Web.UI.WebControls.TextBox txtFirstName;

private void Page_Load(object sender, System.EventArgs e)
{
//nothing
}

#region Web Form Designer generated code
//left out for clarity, nothing has
been
altered
#endregion
}
}



Thank you for your help
dave
 
D

David A. Coursey

Ok, that clears that up, but now the other question is why do I get an error
when using the get/set method? It compiles fine, but when it runs it throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip
 
A

Alvin Bruney [MVP]

i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps
 
D

David A. Coursey

No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

Alvin Bruney said:
i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
Ok, that clears that up, but now the other question is why do I get an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip
 
A

Alvin Bruney [MVP]

No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

no, because i am getting as well.

i'll take a closer look in a while (mildly busy at the moment).

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

Alvin Bruney said:
i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
Ok, that clears that up, but now the other question is why do I get an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip

:

you've made the textbox a static instance. controls cannot be static
because
it interfers with the viewstate mechanism. instead you should store
the
data
in a static variable. consider a get/set method to move the data in
the
textbox into a static reference
 
A

Alvin Bruney [MVP]

I'm stopping just short of calling this behavior a bug.

I need to do a couple days research on this because clearly i don't
understand what is going on.

From what i gather so far,the main page fires its page load events, next the
usercontrols load event fires. at this point strangely, the textbox declared
on the page is a null reference. so attempting to assign variables at the
point will bomb.

i had success with moving the assignment to the page unload event. but even
there, the expected behavior is somewhat quirky; it will bomb the first
time, but work as intended for every subsequent run. I understand the
usercontrols are self contained and the design should reflect this but it
doesn't explain why this is happening.

i feel like a deer stuck in the headlights tehehehe. it will probably be a
week or so before i have something definitive on this.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin Bruney said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

no, because i am getting as well.

i'll take a closer look in a while (mildly busy at the moment).

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

Alvin Bruney said:
i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message Ok, that clears that up, but now the other question is why do I get an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip

:

you've made the textbox a static instance. controls cannot be static
because
it interfers with the viewstate mechanism. instead you should store
the
data
in a static variable. consider a get/set method to move the data in
the
textbox into a static reference
 
D

David A. Coursey

Thank you very much for even taking the time to look into this. I am very
interested in what your results may be because I was very confused as well.
For now I will redesign the pages without user controls (which will make one
gi-normus aspx page) and keep moving forward on the project.

Again, thank you for your help
David A. Coursey


Alvin Bruney said:
I'm stopping just short of calling this behavior a bug.

I need to do a couple days research on this because clearly i don't
understand what is going on.

From what i gather so far,the main page fires its page load events, next
the usercontrols load event fires. at this point strangely, the textbox
declared on the page is a null reference. so attempting to assign
variables at the point will bomb.

i had success with moving the assignment to the page unload event. but
even there, the expected behavior is somewhat quirky; it will bomb the
first time, but work as intended for every subsequent run. I understand
the usercontrols are self contained and the design should reflect this but
it doesn't explain why this is happening.

i feel like a deer stuck in the headlights tehehehe. it will probably be a
week or so before i have something definitive on this.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin Bruney said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

no, because i am getting as well.

i'll take a closer look in a while (mildly busy at the moment).

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

:

i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message Ok, that clears that up, but now the other question is why do I get
an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip

:

you've made the textbox a static instance. controls cannot be static
because
it interfers with the viewstate mechanism. instead you should store
the
data
in a static variable. consider a get/set method to move the data in
the
textbox into a static reference
 
A

Alvin Bruney [MVP]

oooops,
did you figure this out? This message was lost in my pending box for a
couple weeks

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin Bruney said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

no, because i am getting as well.

i'll take a closer look in a while (mildly busy at the moment).

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

Alvin Bruney said:
i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message Ok, that clears that up, but now the other question is why do I get an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip

:

you've made the textbox a static instance. controls cannot be static
because
it interfers with the viewstate mechanism. instead you should store
the
data
in a static variable. consider a get/set method to move the data in
the
textbox into a static reference
 
D

David A. Coursey

I just came back to look at this post again.

No I never did get it to work. I ended up ditching the user controls and
having the code all on one aspx page. This is really a bad way to work
because I am unable to switch to design view, the code gets horribly hacked
if I do.

dave

Alvin Bruney said:
oooops,
did you figure this out? This message was lost in my pending box for a
couple weeks

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin Bruney said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

no, because i am getting as well.

i'll take a closer look in a while (mildly busy at the moment).

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
David A. Coursey said:
No dice... I can even reboot and it will still have the same results.
Could this be a bad install possibly?

:

i believe you are running into a caching problem notorius with user
controls. try closing the project restarting iis and re-opening the
solution. see if that helps

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message Ok, that clears that up, but now the other question is why do I get an
error
when using the get/set method? It compiles fine, but when it runs it
throws
an error because it can't find the item that is being set/get.
Try this code in place of the other:

www.3doverdose.com/dl/CMAstripped02.zip

:

you've made the textbox a static instance. controls cannot be static
because
it interfers with the viewstate mechanism. instead you should store
the
data
in a static variable. consider a get/set method to move the data in
the
textbox into a static reference
 

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

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top