By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,534 Members | 1,830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,534 IT Pros & Developers. It's quick & easy.

User control not updating

P: n/a
Hello all,
I have something very simple going on here and I'm scratching my head
as to what the problem is. There are 4 items in my project, 2 webforms,
a user control, and a module:

WebForm1.aspx
ChangeValue.aspx
WebUserControl1.ascx
Module1.vb

Here's the flow:
WebForm1 is the start page and has a placeholder that gets populated
with WebUserControl1. Module1.vb has a public variable called strTest.
The page load of WebForm1 set this string to "Some Value". (Provided
it's not a postback)
On WebUserControl1, there is a textbox and a label. The page load of
the usercontrol sets the values of both the textbox and the label to
the value of strTest. (So it gets set to "Some Value" on the first
load. There is a plain old html button on WebUserControl1 that executes
some client script to open a popup window. The popup window opens
ChangeValue.aspx.
ChangeValue.aspx has some code in the page load that changes the value
of strTest from "Some Value" to "New Value". It also has a button that
executes some client script to refresh the parent window and close the
popup.
So the value of both the textbox and the label in the usercontrol
should now read "New Value". However, ONLY the label is getting
updated. This is utterly confusing, my page is definitely getting
refreshed or the label would still say "Some Value" instead of "New
Value". The code for each of the 4 items follows, I can't figure this
one out for the life of me. Any help would be appreciated.

Here's Module1:

Module Module1

Public strTest As String

End Module
Here's WebForm1.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
</body>
Here's WebForm1.aspx (Code Behind):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
strTest = "Some Value"
End If

Dim ctrTextBox As WebUserControl1
PlaceHolder1.Controls.Clear()
ctrTextBox = LoadControl("WebUserControl1.ascx")
ctrTextBox.ID = "WebUC1"
PlaceHolder1.Controls.Add(ctrTextBox)
End Sub
Here's WebUserControl1.ascx (HTML):

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<br>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
<INPUT type="button" value="Open Popup"
onclick="window.open('ChangeValue.aspx')">

Here's WebUserControl1.ascx (VB):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

TextBox1.Text = strTest
Label1.Text = strTest

End Sub

Here's ChangeValue.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Here's ChangeValue.aspx (VB):
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Nov 19 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
I was able to recreate... Looking into it now.
The variable is indeed set to the right value, it's just something with the
rendering of the TextBox that's the issue.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Hello all,
I have something very simple going on here and I'm scratching my head
as to what the problem is. There are 4 items in my project, 2 webforms,
a user control, and a module:

WebForm1.aspx
ChangeValue.aspx
WebUserControl1.ascx
Module1.vb

Here's the flow:
WebForm1 is the start page and has a placeholder that gets populated
with WebUserControl1. Module1.vb has a public variable called strTest.
The page load of WebForm1 set this string to "Some Value". (Provided
it's not a postback)
On WebUserControl1, there is a textbox and a label. The page load of
the usercontrol sets the values of both the textbox and the label to
the value of strTest. (So it gets set to "Some Value" on the first
load. There is a plain old html button on WebUserControl1 that executes
some client script to open a popup window. The popup window opens
ChangeValue.aspx.
ChangeValue.aspx has some code in the page load that changes the value
of strTest from "Some Value" to "New Value". It also has a button that
executes some client script to refresh the parent window and close the
popup.
So the value of both the textbox and the label in the usercontrol
should now read "New Value". However, ONLY the label is getting
updated. This is utterly confusing, my page is definitely getting
refreshed or the label would still say "Some Value" instead of "New
Value". The code for each of the 4 items follows, I can't figure this
one out for the life of me. Any help would be appreciated.

Here's Module1:

Module Module1

Public strTest As String

End Module
Here's WebForm1.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
</body>
Here's WebForm1.aspx (Code Behind):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
strTest = "Some Value"
End If

Dim ctrTextBox As WebUserControl1
PlaceHolder1.Controls.Clear()
ctrTextBox = LoadControl("WebUserControl1.ascx")
ctrTextBox.ID = "WebUC1"
PlaceHolder1.Controls.Add(ctrTextBox)
End Sub
Here's WebUserControl1.ascx (HTML):

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<br>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
<INPUT type="button" value="Open Popup"
onclick="window.open('ChangeValue.aspx')">

Here's WebUserControl1.ascx (VB):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

TextBox1.Text = strTest
Label1.Text = strTest

End Sub

Here's ChangeValue.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Here's ChangeValue.aspx (VB):
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Nov 19 '05 #2

P: n/a
Sorry, here you go:

ChangeValue.aspx (VB)

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strTest = "New Value"
End Sub

ChangeValue.aspx (HTML)

<HTML>
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent" onclick =
"reloadAndClose()">
</form>
</body>
</HTML>


"Curt_C [MVP]" wrote:
where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
the html twice)

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:

> Hello all,
> I have something very simple going on here and I'm scratching my head
> as to what the problem is. There are 4 items in my project, 2 webforms,
> a user control, and a module:
>
> WebForm1.aspx
> ChangeValue.aspx
> WebUserControl1.ascx
> Module1.vb
>
> Here's the flow:
> WebForm1 is the start page and has a placeholder that gets populated
> with WebUserControl1. Module1.vb has a public variable called strTest.
> The page load of WebForm1 set this string to "Some Value". (Provided
> it's not a postback)
> On WebUserControl1, there is a textbox and a label. The page load of
> the usercontrol sets the values of both the textbox and the label to
> the value of strTest. (So it gets set to "Some Value" on the first
> load. There is a plain old html button on WebUserControl1 that executes
> some client script to open a popup window. The popup window opens
> ChangeValue.aspx.
> ChangeValue.aspx has some code in the page load that changes the value
> of strTest from "Some Value" to "New Value". It also has a button that
> executes some client script to refresh the parent window and close the
> popup.
> So the value of both the textbox and the label in the usercontrol
> should now read "New Value". However, ONLY the label is getting
> updated. This is utterly confusing, my page is definitely getting
> refreshed or the label would still say "Some Value" instead of "New
> Value". The code for each of the 4 items follows, I can't figure this
> one out for the life of me. Any help would be appreciated.
>
> Here's Module1:
>
> Module Module1
>
> Public strTest As String
>
> End Module
>
>
> Here's WebForm1.aspx (HTML):
>
> <body>
> <form id="Form1" method="post" runat="server">
> <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> </form>
> </body>
>
>
> Here's WebForm1.aspx (Code Behind):
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> If Not Page.IsPostBack Then
> strTest = "Some Value"
> End If
>
>
>
> Dim ctrTextBox As WebUserControl1
>
>
> PlaceHolder1.Controls.Clear()
> ctrTextBox = LoadControl("WebUserControl1.ascx")
> ctrTextBox.ID = "WebUC1"
> PlaceHolder1.Controls.Add(ctrTextBox)
> End Sub
>
>
> Here's WebUserControl1.ascx (HTML):
>
> <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> <br>
> <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> <INPUT type="button" value="Open Popup"
> onclick="window.open('ChangeValue.aspx')">
>
> Here's WebUserControl1.ascx (VB):
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
>
> TextBox1.Text = strTest
> Label1.Text = strTest
>
> End Sub
>
> Here's ChangeValue.aspx (HTML):
>
> <body>
> <form id="Form1" method="post" runat="server">
> <INPUT type="button" value="Change variable and reload parent"
> onclick = "reloadAndClose()">
> </form>
> </body>
>
> Here's ChangeValue.aspx (VB):
>
>
> <HEAD>
>
> <script>
> function reloadAndClose() {
> window.opener.document.Form1.submit();
>
> window.close();
>
> }
> </script>
> </HEAD>
> <body>
> <form id="Form1" method="post" runat="server">
> <INPUT type="button" value="Change variable and reload parent"
> onclick = "reloadAndClose()">
> </form>
> </body>
>
>

Nov 19 '05 #3

P: n/a
Yeah I noticed the same thing, if it's all one page it works fine, it only
doesn't work on the user control. But I'm stuck with the user controls in
this case, and it's MS recommended to use them so I want to be a good citizen.
Thanks for your help.

"Curt_C [MVP]" wrote:
if you put the control on the page it works fine...

Weird... I'll look into it more tonight if no one finds a solution, but I'm
assuming its somethign with the Render event on the textbox.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Sorry, here you go:

ChangeValue.aspx (VB)

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strTest = "New Value"
End Sub

ChangeValue.aspx (HTML)

<HTML>
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent" onclick =
"reloadAndClose()">
</form>
</body>
</HTML>


"Curt_C [MVP]" wrote:
where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
the html twice)

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:

> That's why I included the code, it's a very small project.
>
> The popup is refreshing the parent. It's working perfectly for the label,
> but the textbox is not updating. The core question being, why is the label
> being updated but not the textbox? The code is identical:
>
> TextBox1.Text = strTest
> Label1.Text = strTest
>
> Jeff
>
> "Curt_C [MVP]" wrote:
>
> > not 100% sure I followed BUT...
> > you say you are calling the parent page to refresh... is this being
> > recognized in the code-behind as NOT a PostBack(), since its really not, and
> > the value is being reset?
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "sqlboy2000" wrote:
> >
> > > Hello all,
> > > I have something very simple going on here and I'm scratching my head
> > > as to what the problem is. There are 4 items in my project, 2 webforms,
> > > a user control, and a module:
> > >
> > > WebForm1.aspx
> > > ChangeValue.aspx
> > > WebUserControl1.ascx
> > > Module1.vb
> > >
> > > Here's the flow:
> > > WebForm1 is the start page and has a placeholder that gets populated
> > > with WebUserControl1. Module1.vb has a public variable called strTest.
> > > The page load of WebForm1 set this string to "Some Value". (Provided
> > > it's not a postback)
> > > On WebUserControl1, there is a textbox and a label. The page load of
> > > the usercontrol sets the values of both the textbox and the label to
> > > the value of strTest. (So it gets set to "Some Value" on the first
> > > load. There is a plain old html button on WebUserControl1 that executes
> > > some client script to open a popup window. The popup window opens
> > > ChangeValue.aspx.
> > > ChangeValue.aspx has some code in the page load that changes the value
> > > of strTest from "Some Value" to "New Value". It also has a button that
> > > executes some client script to refresh the parent window and close the
> > > popup.
> > > So the value of both the textbox and the label in the usercontrol
> > > should now read "New Value". However, ONLY the label is getting
> > > updated. This is utterly confusing, my page is definitely getting
> > > refreshed or the label would still say "Some Value" instead of "New
> > > Value". The code for each of the 4 items follows, I can't figure this
> > > one out for the life of me. Any help would be appreciated.
> > >
> > > Here's Module1:
> > >
> > > Module Module1
> > >
> > > Public strTest As String
> > >
> > > End Module
> > >
> > >
> > > Here's WebForm1.aspx (HTML):
> > >
> > > <body>
> > > <form id="Form1" method="post" runat="server">
> > > <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> > > </form>
> > > </body>
> > >
> > >
> > > Here's WebForm1.aspx (Code Behind):
> > >
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load
> > > 'Put user code to initialize the page here
> > > If Not Page.IsPostBack Then
> > > strTest = "Some Value"
> > > End If
> > >
> > >
> > >
> > > Dim ctrTextBox As WebUserControl1
> > >
> > >
> > > PlaceHolder1.Controls.Clear()
> > > ctrTextBox = LoadControl("WebUserControl1.ascx")
> > > ctrTextBox.ID = "WebUC1"
> > > PlaceHolder1.Controls.Add(ctrTextBox)
> > > End Sub
> > >
> > >
> > > Here's WebUserControl1.ascx (HTML):
> > >
> > > <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> > > <br>
> > > <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> > > <INPUT type="button" value="Open Popup"
> > > onclick="window.open('ChangeValue.aspx')">
> > >
> > > Here's WebUserControl1.ascx (VB):
> > >
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load
> > > 'Put user code to initialize the page here
> > >
> > > TextBox1.Text = strTest
> > > Label1.Text = strTest
> > >
> > > End Sub
> > >
> > > Here's ChangeValue.aspx (HTML):
> > >
> > > <body>
> > > <form id="Form1" method="post" runat="server">
> > > <INPUT type="button" value="Change variable and reload parent"
> > > onclick = "reloadAndClose()">
> > > </form>
> > > </body>
> > >
> > > Here's ChangeValue.aspx (VB):
> > >
> > >
> > > <HEAD>
> > >
> > > <script>
> > > function reloadAndClose() {
> > > window.opener.document.Form1.submit();
> > >
> > > window.close();
> > >
> > > }
> > > </script>
> > > </HEAD>
> > > <body>
> > > <form id="Form1" method="post" runat="server">
> > > <INPUT type="button" value="Change variable and reload parent"
> > > onclick = "reloadAndClose()">
> > > </form>
> > > </body>
> > >
> > >

Nov 19 '05 #4

P: n/a
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Hello all,
I have something very simple going on here and I'm scratching my head
as to what the problem is. There are 4 items in my project, 2 webforms,
a user control, and a module:

WebForm1.aspx
ChangeValue.aspx
WebUserControl1.ascx
Module1.vb

Here's the flow:
WebForm1 is the start page and has a placeholder that gets populated
with WebUserControl1. Module1.vb has a public variable called strTest.
The page load of WebForm1 set this string to "Some Value". (Provided
it's not a postback)
On WebUserControl1, there is a textbox and a label. The page load of
the usercontrol sets the values of both the textbox and the label to
the value of strTest. (So it gets set to "Some Value" on the first
load. There is a plain old html button on WebUserControl1 that executes
some client script to open a popup window. The popup window opens
ChangeValue.aspx.
ChangeValue.aspx has some code in the page load that changes the value
of strTest from "Some Value" to "New Value". It also has a button that
executes some client script to refresh the parent window and close the
popup.
So the value of both the textbox and the label in the usercontrol
should now read "New Value". However, ONLY the label is getting
updated. This is utterly confusing, my page is definitely getting
refreshed or the label would still say "Some Value" instead of "New
Value". The code for each of the 4 items follows, I can't figure this
one out for the life of me. Any help would be appreciated.

Here's Module1:

Module Module1

Public strTest As String

End Module
Here's WebForm1.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
</body>
Here's WebForm1.aspx (Code Behind):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
strTest = "Some Value"
End If

Dim ctrTextBox As WebUserControl1
PlaceHolder1.Controls.Clear()
ctrTextBox = LoadControl("WebUserControl1.ascx")
ctrTextBox.ID = "WebUC1"
PlaceHolder1.Controls.Add(ctrTextBox)
End Sub
Here's WebUserControl1.ascx (HTML):

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<br>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
<INPUT type="button" value="Open Popup"
onclick="window.open('ChangeValue.aspx')">

Here's WebUserControl1.ascx (VB):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

TextBox1.Text = strTest
Label1.Text = strTest

End Sub

Here's ChangeValue.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Here's ChangeValue.aspx (VB):
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Nov 19 '05 #5

P: n/a
Thank you. At least I'm not going crazy. Maybe.

"Curt_C [MVP]" wrote:
I was able to recreate... Looking into it now.
The variable is indeed set to the right value, it's just something with the
rendering of the TextBox that's the issue.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:

> Hello all,
> I have something very simple going on here and I'm scratching my head
> as to what the problem is. There are 4 items in my project, 2 webforms,
> a user control, and a module:
>
> WebForm1.aspx
> ChangeValue.aspx
> WebUserControl1.ascx
> Module1.vb
>
> Here's the flow:
> WebForm1 is the start page and has a placeholder that gets populated
> with WebUserControl1. Module1.vb has a public variable called strTest.
> The page load of WebForm1 set this string to "Some Value". (Provided
> it's not a postback)
> On WebUserControl1, there is a textbox and a label. The page load of
> the usercontrol sets the values of both the textbox and the label to
> the value of strTest. (So it gets set to "Some Value" on the first
> load. There is a plain old html button on WebUserControl1 that executes
> some client script to open a popup window. The popup window opens
> ChangeValue.aspx.
> ChangeValue.aspx has some code in the page load that changes the value
> of strTest from "Some Value" to "New Value". It also has a button that
> executes some client script to refresh the parent window and close the
> popup.
> So the value of both the textbox and the label in the usercontrol
> should now read "New Value". However, ONLY the label is getting
> updated. This is utterly confusing, my page is definitely getting
> refreshed or the label would still say "Some Value" instead of "New
> Value". The code for each of the 4 items follows, I can't figure this
> one out for the life of me. Any help would be appreciated.
>
> Here's Module1:
>
> Module Module1
>
> Public strTest As String
>
> End Module
>
>
> Here's WebForm1.aspx (HTML):
>
> <body>
> <form id="Form1" method="post" runat="server">
> <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> </form>
> </body>
>
>
> Here's WebForm1.aspx (Code Behind):
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> If Not Page.IsPostBack Then
> strTest = "Some Value"
> End If
>
>
>
> Dim ctrTextBox As WebUserControl1
>
>
> PlaceHolder1.Controls.Clear()
> ctrTextBox = LoadControl("WebUserControl1.ascx")
> ctrTextBox.ID = "WebUC1"
> PlaceHolder1.Controls.Add(ctrTextBox)
> End Sub
>
>
> Here's WebUserControl1.ascx (HTML):
>
> <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> <br>
> <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> <INPUT type="button" value="Open Popup"
> onclick="window.open('ChangeValue.aspx')">
>
> Here's WebUserControl1.ascx (VB):
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
>
> TextBox1.Text = strTest
> Label1.Text = strTest
>
> End Sub
>
> Here's ChangeValue.aspx (HTML):
>
> <body>
> <form id="Form1" method="post" runat="server">
> <INPUT type="button" value="Change variable and reload parent"
> onclick = "reloadAndClose()">
> </form>
> </body>
>
> Here's ChangeValue.aspx (VB):
>
>
> <HEAD>
>
> <script>
> function reloadAndClose() {
> window.opener.document.Form1.submit();
>
> window.close();
>
> }
> </script>
> </HEAD>
> <body>
> <form id="Form1" method="post" runat="server">
> <INPUT type="button" value="Change variable and reload parent"
> onclick = "reloadAndClose()">
> </form>
> </body>
>
>

Nov 19 '05 #6

P: n/a
if you put the control on the page it works fine...

Weird... I'll look into it more tonight if no one finds a solution, but I'm
assuming its somethign with the Render event on the textbox.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Sorry, here you go:

ChangeValue.aspx (VB)

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strTest = "New Value"
End Sub

ChangeValue.aspx (HTML)

<HTML>
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent" onclick =
"reloadAndClose()">
</form>
</body>
</HTML>


"Curt_C [MVP]" wrote:
where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
the html twice)

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:

> not 100% sure I followed BUT...
> you say you are calling the parent page to refresh... is this being
> recognized in the code-behind as NOT a PostBack(), since its really not, and
> the value is being reset?
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "sqlboy2000" wrote:
>
> > Hello all,
> > I have something very simple going on here and I'm scratching my head
> > as to what the problem is. There are 4 items in my project, 2 webforms,
> > a user control, and a module:
> >
> > WebForm1.aspx
> > ChangeValue.aspx
> > WebUserControl1.ascx
> > Module1.vb
> >
> > Here's the flow:
> > WebForm1 is the start page and has a placeholder that gets populated
> > with WebUserControl1. Module1.vb has a public variable called strTest.
> > The page load of WebForm1 set this string to "Some Value". (Provided
> > it's not a postback)
> > On WebUserControl1, there is a textbox and a label. The page load of
> > the usercontrol sets the values of both the textbox and the label to
> > the value of strTest. (So it gets set to "Some Value" on the first
> > load. There is a plain old html button on WebUserControl1 that executes
> > some client script to open a popup window. The popup window opens
> > ChangeValue.aspx.
> > ChangeValue.aspx has some code in the page load that changes the value
> > of strTest from "Some Value" to "New Value". It also has a button that
> > executes some client script to refresh the parent window and close the
> > popup.
> > So the value of both the textbox and the label in the usercontrol
> > should now read "New Value". However, ONLY the label is getting
> > updated. This is utterly confusing, my page is definitely getting
> > refreshed or the label would still say "Some Value" instead of "New
> > Value". The code for each of the 4 items follows, I can't figure this
> > one out for the life of me. Any help would be appreciated.
> >
> > Here's Module1:
> >
> > Module Module1
> >
> > Public strTest As String
> >
> > End Module
> >
> >
> > Here's WebForm1.aspx (HTML):
> >
> > <body>
> > <form id="Form1" method="post" runat="server">
> > <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> > </form>
> > </body>
> >
> >
> > Here's WebForm1.aspx (Code Behind):
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > 'Put user code to initialize the page here
> > If Not Page.IsPostBack Then
> > strTest = "Some Value"
> > End If
> >
> >
> >
> > Dim ctrTextBox As WebUserControl1
> >
> >
> > PlaceHolder1.Controls.Clear()
> > ctrTextBox = LoadControl("WebUserControl1.ascx")
> > ctrTextBox.ID = "WebUC1"
> > PlaceHolder1.Controls.Add(ctrTextBox)
> > End Sub
> >
> >
> > Here's WebUserControl1.ascx (HTML):
> >
> > <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> > <br>
> > <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> > <INPUT type="button" value="Open Popup"
> > onclick="window.open('ChangeValue.aspx')">
> >
> > Here's WebUserControl1.ascx (VB):
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > 'Put user code to initialize the page here
> >
> > TextBox1.Text = strTest
> > Label1.Text = strTest
> >
> > End Sub
> >
> > Here's ChangeValue.aspx (HTML):
> >
> > <body>
> > <form id="Form1" method="post" runat="server">
> > <INPUT type="button" value="Change variable and reload parent"
> > onclick = "reloadAndClose()">
> > </form>
> > </body>
> >
> > Here's ChangeValue.aspx (VB):
> >
> >
> > <HEAD>
> >
> > <script>
> > function reloadAndClose() {
> > window.opener.document.Form1.submit();
> >
> > window.close();
> >
> > }
> > </script>
> > </HEAD>
> > <body>
> > <form id="Form1" method="post" runat="server">
> > <INPUT type="button" value="Change variable and reload parent"
> > onclick = "reloadAndClose()">
> > </form>
> > </body>
> >
> >

Nov 19 '05 #7

P: n/a
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Hello all,
I have something very simple going on here and I'm scratching my head
as to what the problem is. There are 4 items in my project, 2 webforms,
a user control, and a module:

WebForm1.aspx
ChangeValue.aspx
WebUserControl1.ascx
Module1.vb

Here's the flow:
WebForm1 is the start page and has a placeholder that gets populated
with WebUserControl1. Module1.vb has a public variable called strTest.
The page load of WebForm1 set this string to "Some Value". (Provided
it's not a postback)
On WebUserControl1, there is a textbox and a label. The page load of
the usercontrol sets the values of both the textbox and the label to
the value of strTest. (So it gets set to "Some Value" on the first
load. There is a plain old html button on WebUserControl1 that executes
some client script to open a popup window. The popup window opens
ChangeValue.aspx.
ChangeValue.aspx has some code in the page load that changes the value
of strTest from "Some Value" to "New Value". It also has a button that
executes some client script to refresh the parent window and close the
popup.
So the value of both the textbox and the label in the usercontrol
should now read "New Value". However, ONLY the label is getting
updated. This is utterly confusing, my page is definitely getting
refreshed or the label would still say "Some Value" instead of "New
Value". The code for each of the 4 items follows, I can't figure this
one out for the life of me. Any help would be appreciated.

Here's Module1:

Module Module1

Public strTest As String

End Module
Here's WebForm1.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
</body>
Here's WebForm1.aspx (Code Behind):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
strTest = "Some Value"
End If

Dim ctrTextBox As WebUserControl1
PlaceHolder1.Controls.Clear()
ctrTextBox = LoadControl("WebUserControl1.ascx")
ctrTextBox.ID = "WebUC1"
PlaceHolder1.Controls.Add(ctrTextBox)
End Sub
Here's WebUserControl1.ascx (HTML):

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<br>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
<INPUT type="button" value="Open Popup"
onclick="window.open('ChangeValue.aspx')">

Here's WebUserControl1.ascx (VB):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

TextBox1.Text = strTest
Label1.Text = strTest

End Sub

Here's ChangeValue.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Here's ChangeValue.aspx (VB):
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Nov 19 '05 #8

P: n/a
where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
the html twice)

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
That's why I included the code, it's a very small project.

The popup is refreshing the parent. It's working perfectly for the label,
but the textbox is not updating. The core question being, why is the label
being updated but not the textbox? The code is identical:

TextBox1.Text = strTest
Label1.Text = strTest

Jeff

"Curt_C [MVP]" wrote:
not 100% sure I followed BUT...
you say you are calling the parent page to refresh... is this being
recognized in the code-behind as NOT a PostBack(), since its really not, and
the value is being reset?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Hello all,
I have something very simple going on here and I'm scratching my head
as to what the problem is. There are 4 items in my project, 2 webforms,
a user control, and a module:

WebForm1.aspx
ChangeValue.aspx
WebUserControl1.ascx
Module1.vb

Here's the flow:
WebForm1 is the start page and has a placeholder that gets populated
with WebUserControl1. Module1.vb has a public variable called strTest.
The page load of WebForm1 set this string to "Some Value". (Provided
it's not a postback)
On WebUserControl1, there is a textbox and a label. The page load of
the usercontrol sets the values of both the textbox and the label to
the value of strTest. (So it gets set to "Some Value" on the first
load. There is a plain old html button on WebUserControl1 that executes
some client script to open a popup window. The popup window opens
ChangeValue.aspx.
ChangeValue.aspx has some code in the page load that changes the value
of strTest from "Some Value" to "New Value". It also has a button that
executes some client script to refresh the parent window and close the
popup.
So the value of both the textbox and the label in the usercontrol
should now read "New Value". However, ONLY the label is getting
updated. This is utterly confusing, my page is definitely getting
refreshed or the label would still say "Some Value" instead of "New
Value". The code for each of the 4 items follows, I can't figure this
one out for the life of me. Any help would be appreciated.

Here's Module1:

Module Module1

Public strTest As String

End Module
Here's WebForm1.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
</body>
Here's WebForm1.aspx (Code Behind):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
strTest = "Some Value"
End If

Dim ctrTextBox As WebUserControl1
PlaceHolder1.Controls.Clear()
ctrTextBox = LoadControl("WebUserControl1.ascx")
ctrTextBox.ID = "WebUC1"
PlaceHolder1.Controls.Add(ctrTextBox)
End Sub
Here's WebUserControl1.ascx (HTML):

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<br>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
<INPUT type="button" value="Open Popup"
onclick="window.open('ChangeValue.aspx')">

Here's WebUserControl1.ascx (VB):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

TextBox1.Text = strTest
Label1.Text = strTest

End Sub

Here's ChangeValue.aspx (HTML):

<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Here's ChangeValue.aspx (VB):
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent"
onclick = "reloadAndClose()">
</form>
</body>

Nov 19 '05 #9

P: n/a
The user control works fine, its just the way you are putting them onto the
page (dynamically) that's causing it to have a problem....

I was unable to find a solution, perhaps an MS person could clarify why this
would happen....
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Yeah I noticed the same thing, if it's all one page it works fine, it only
doesn't work on the user control. But I'm stuck with the user controls in
this case, and it's MS recommended to use them so I want to be a good citizen.
Thanks for your help.

"Curt_C [MVP]" wrote:
if you put the control on the page it works fine...

Weird... I'll look into it more tonight if no one finds a solution, but I'm
assuming its somethign with the Render event on the textbox.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Sorry, here you go:

ChangeValue.aspx (VB)

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strTest = "New Value"
End Sub

ChangeValue.aspx (HTML)

<HTML>
<HEAD>

<script>
function reloadAndClose() {
window.opener.document.Form1.submit();

window.close();

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="Change variable and reload parent" onclick =
"reloadAndClose()">
</form>
</body>
</HTML>


"Curt_C [MVP]" wrote:

> where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
> the html twice)
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "sqlboy2000" wrote:
>
> > That's why I included the code, it's a very small project.
> >
> > The popup is refreshing the parent. It's working perfectly for the label,
> > but the textbox is not updating. The core question being, why is the label
> > being updated but not the textbox? The code is identical:
> >
> > TextBox1.Text = strTest
> > Label1.Text = strTest
> >
> > Jeff
> >
> > "Curt_C [MVP]" wrote:
> >
> > > not 100% sure I followed BUT...
> > > you say you are calling the parent page to refresh... is this being
> > > recognized in the code-behind as NOT a PostBack(), since its really not, and
> > > the value is being reset?
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "sqlboy2000" wrote:
> > >
> > > > Hello all,
> > > > I have something very simple going on here and I'm scratching my head
> > > > as to what the problem is. There are 4 items in my project, 2 webforms,
> > > > a user control, and a module:
> > > >
> > > > WebForm1.aspx
> > > > ChangeValue.aspx
> > > > WebUserControl1.ascx
> > > > Module1.vb
> > > >
> > > > Here's the flow:
> > > > WebForm1 is the start page and has a placeholder that gets populated
> > > > with WebUserControl1. Module1.vb has a public variable called strTest.
> > > > The page load of WebForm1 set this string to "Some Value". (Provided
> > > > it's not a postback)
> > > > On WebUserControl1, there is a textbox and a label. The page load of
> > > > the usercontrol sets the values of both the textbox and the label to
> > > > the value of strTest. (So it gets set to "Some Value" on the first
> > > > load. There is a plain old html button on WebUserControl1 that executes
> > > > some client script to open a popup window. The popup window opens
> > > > ChangeValue.aspx.
> > > > ChangeValue.aspx has some code in the page load that changes the value
> > > > of strTest from "Some Value" to "New Value". It also has a button that
> > > > executes some client script to refresh the parent window and close the
> > > > popup.
> > > > So the value of both the textbox and the label in the usercontrol
> > > > should now read "New Value". However, ONLY the label is getting
> > > > updated. This is utterly confusing, my page is definitely getting
> > > > refreshed or the label would still say "Some Value" instead of "New
> > > > Value". The code for each of the 4 items follows, I can't figure this
> > > > one out for the life of me. Any help would be appreciated.
> > > >
> > > > Here's Module1:
> > > >
> > > > Module Module1
> > > >
> > > > Public strTest As String
> > > >
> > > > End Module
> > > >
> > > >
> > > > Here's WebForm1.aspx (HTML):
> > > >
> > > > <body>
> > > > <form id="Form1" method="post" runat="server">
> > > > <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> > > > </form>
> > > > </body>
> > > >
> > > >
> > > > Here's WebForm1.aspx (Code Behind):
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > > 'Put user code to initialize the page here
> > > > If Not Page.IsPostBack Then
> > > > strTest = "Some Value"
> > > > End If
> > > >
> > > >
> > > >
> > > > Dim ctrTextBox As WebUserControl1
> > > >
> > > >
> > > > PlaceHolder1.Controls.Clear()
> > > > ctrTextBox = LoadControl("WebUserControl1.ascx")
> > > > ctrTextBox.ID = "WebUC1"
> > > > PlaceHolder1.Controls.Add(ctrTextBox)
> > > > End Sub
> > > >
> > > >
> > > > Here's WebUserControl1.ascx (HTML):
> > > >
> > > > <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> > > > <br>
> > > > <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> > > > <INPUT type="button" value="Open Popup"
> > > > onclick="window.open('ChangeValue.aspx')">
> > > >
> > > > Here's WebUserControl1.ascx (VB):
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > > 'Put user code to initialize the page here
> > > >
> > > > TextBox1.Text = strTest
> > > > Label1.Text = strTest
> > > >
> > > > End Sub
> > > >
> > > > Here's ChangeValue.aspx (HTML):
> > > >
> > > > <body>
> > > > <form id="Form1" method="post" runat="server">
> > > > <INPUT type="button" value="Change variable and reload parent"
> > > > onclick = "reloadAndClose()">
> > > > </form>
> > > > </body>
> > > >
> > > > Here's ChangeValue.aspx (VB):
> > > >
> > > >
> > > > <HEAD>
> > > >
> > > > <script>
> > > > function reloadAndClose() {
> > > > window.opener.document.Form1.submit();
> > > >
> > > > window.close();
> > > >
> > > > }
> > > > </script>
> > > > </HEAD>
> > > > <body>
> > > > <form id="Form1" method="post" runat="server">
> > > > <INPUT type="button" value="Change variable and reload parent"
> > > > onclick = "reloadAndClose()">
> > > > </form>
> > > > </body>
> > > >
> > > >

Nov 19 '05 #10

P: n/a
I was able to come up with a workaround, if I put the code in the prerender
event of textbox instead of the page load event, the textbox get's refreshed
with the correct value. Seems like a hokey solution, any input here MS?
"Curt_C [MVP]" wrote:
The user control works fine, its just the way you are putting them onto the
page (dynamically) that's causing it to have a problem....

I was unable to find a solution, perhaps an MS person could clarify why this
would happen....
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:
Yeah I noticed the same thing, if it's all one page it works fine, it only
doesn't work on the user control. But I'm stuck with the user controls in
this case, and it's MS recommended to use them so I want to be a good citizen.
Thanks for your help.

"Curt_C [MVP]" wrote:
if you put the control on the page it works fine...

Weird... I'll look into it more tonight if no one finds a solution, but I'm
assuming its somethign with the Render event on the textbox.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"sqlboy2000" wrote:

> Sorry, here you go:
>
> ChangeValue.aspx (VB)
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> strTest = "New Value"
> End Sub
>
> ChangeValue.aspx (HTML)
>
> <HTML>
> <HEAD>
>
> <script>
> function reloadAndClose() {
> window.opener.document.Form1.submit();
>
> window.close();
>
> }
> </script>
> </HEAD>
> <body>
> <form id="Form1" method="post" runat="server">
> <INPUT type="button" value="Change variable and reload parent" onclick =
> "reloadAndClose()">
> </form>
> </body>
> </HTML>
>
>
>
>
> "Curt_C [MVP]" wrote:
>
> > where is the .vb for ChangeValue.aspx? or is there nothign in it? (you posted
> > the html twice)
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "sqlboy2000" wrote:
> >
> > > That's why I included the code, it's a very small project.
> > >
> > > The popup is refreshing the parent. It's working perfectly for the label,
> > > but the textbox is not updating. The core question being, why is the label
> > > being updated but not the textbox? The code is identical:
> > >
> > > TextBox1.Text = strTest
> > > Label1.Text = strTest
> > >
> > > Jeff
> > >
> > > "Curt_C [MVP]" wrote:
> > >
> > > > not 100% sure I followed BUT...
> > > > you say you are calling the parent page to refresh... is this being
> > > > recognized in the code-behind as NOT a PostBack(), since its really not, and
> > > > the value is being reset?
> > > >
> > > > --
> > > > Curt Christianson
> > > > site: http://www.darkfalz.com
> > > > blog: http://blog.darkfalz.com
> > > >
> > > >
> > > >
> > > > "sqlboy2000" wrote:
> > > >
> > > > > Hello all,
> > > > > I have something very simple going on here and I'm scratching my head
> > > > > as to what the problem is. There are 4 items in my project, 2 webforms,
> > > > > a user control, and a module:
> > > > >
> > > > > WebForm1.aspx
> > > > > ChangeValue.aspx
> > > > > WebUserControl1.ascx
> > > > > Module1.vb
> > > > >
> > > > > Here's the flow:
> > > > > WebForm1 is the start page and has a placeholder that gets populated
> > > > > with WebUserControl1. Module1.vb has a public variable called strTest.
> > > > > The page load of WebForm1 set this string to "Some Value". (Provided
> > > > > it's not a postback)
> > > > > On WebUserControl1, there is a textbox and a label. The page load of
> > > > > the usercontrol sets the values of both the textbox and the label to
> > > > > the value of strTest. (So it gets set to "Some Value" on the first
> > > > > load. There is a plain old html button on WebUserControl1 that executes
> > > > > some client script to open a popup window. The popup window opens
> > > > > ChangeValue.aspx.
> > > > > ChangeValue.aspx has some code in the page load that changes the value
> > > > > of strTest from "Some Value" to "New Value". It also has a button that
> > > > > executes some client script to refresh the parent window and close the
> > > > > popup.
> > > > > So the value of both the textbox and the label in the usercontrol
> > > > > should now read "New Value". However, ONLY the label is getting
> > > > > updated. This is utterly confusing, my page is definitely getting
> > > > > refreshed or the label would still say "Some Value" instead of "New
> > > > > Value". The code for each of the 4 items follows, I can't figure this
> > > > > one out for the life of me. Any help would be appreciated.
> > > > >
> > > > > Here's Module1:
> > > > >
> > > > > Module Module1
> > > > >
> > > > > Public strTest As String
> > > > >
> > > > > End Module
> > > > >
> > > > >
> > > > > Here's WebForm1.aspx (HTML):
> > > > >
> > > > > <body>
> > > > > <form id="Form1" method="post" runat="server">
> > > > > <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
> > > > > </form>
> > > > > </body>
> > > > >
> > > > >
> > > > > Here's WebForm1.aspx (Code Behind):
> > > > >
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > System.EventArgs) Handles MyBase.Load
> > > > > 'Put user code to initialize the page here
> > > > > If Not Page.IsPostBack Then
> > > > > strTest = "Some Value"
> > > > > End If
> > > > >
> > > > >
> > > > >
> > > > > Dim ctrTextBox As WebUserControl1
> > > > >
> > > > >
> > > > > PlaceHolder1.Controls.Clear()
> > > > > ctrTextBox = LoadControl("WebUserControl1.ascx")
> > > > > ctrTextBox.ID = "WebUC1"
> > > > > PlaceHolder1.Controls.Add(ctrTextBox)
> > > > > End Sub
> > > > >
> > > > >
> > > > > Here's WebUserControl1.ascx (HTML):
> > > > >
> > > > > <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
> > > > > <br>
> > > > > <asp:Label id="Label1" runat="server">Label</asp:Label><br>
> > > > > <INPUT type="button" value="Open Popup"
> > > > > onclick="window.open('ChangeValue.aspx')">
> > > > >
> > > > > Here's WebUserControl1.ascx (VB):
> > > > >
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > System.EventArgs) Handles MyBase.Load
> > > > > 'Put user code to initialize the page here
> > > > >
> > > > > TextBox1.Text = strTest
> > > > > Label1.Text = strTest
> > > > >
> > > > > End Sub
> > > > >
> > > > > Here's ChangeValue.aspx (HTML):
> > > > >
> > > > > <body>
> > > > > <form id="Form1" method="post" runat="server">
> > > > > <INPUT type="button" value="Change variable and reload parent"
> > > > > onclick = "reloadAndClose()">
> > > > > </form>
> > > > > </body>
> > > > >
> > > > > Here's ChangeValue.aspx (VB):
> > > > >
> > > > >
> > > > > <HEAD>
> > > > >
> > > > > <script>
> > > > > function reloadAndClose() {
> > > > > window.opener.document.Form1.submit();
> > > > >
> > > > > window.close();
> > > > >
> > > > > }
> > > > > </script>
> > > > > </HEAD>
> > > > > <body>
> > > > > <form id="Form1" method="post" runat="server">
> > > > > <INPUT type="button" value="Change variable and reload parent"
> > > > > onclick = "reloadAndClose()">
> > > > > </form>
> > > > > </body>
> > > > >
> > > > >

Nov 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.