473,471 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

User control not updating

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
10 5775
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Charles Law | last post by:
I have a user control created on the main thread. Let's say, for arguments sake, that it has a single property that maintains a private variable. If I want to set that property from a worker...
2
by: Tolga | last post by:
How do insert a user control i have created into a datagrid cell. Basically i am trying to create a column of my user controls. This is what i have tried so far. int i = 0; while (i <...
1
by: Jon | last post by:
Hi, using vb.net/vs 2003/sql server 2000 Working on a shopping cart app. I've got a user control that appears on every page to give a summary of the users shopping cart, eg You have 12 items in...
1
by: Earl Teigrob | last post by:
Background: When I create a ASP.NET control (User or custom), it often requires security to be set for certain functionality with the control. For example, a news release user control that is...
2
by: Daniel | last post by:
Hi, i have problem with user control: I have created a DIV to dynamically load User control in it. After loading the user control into the DIV, i click on the button to change label's text....
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
2
by: Colli | last post by:
Hi: I need to setup a continuously updating system Date/Time in my user interface. I can get the system date/time and can cause it to update with a button-click but I can't seem to figure out how...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
1
by: Dave A | last post by:
I have a problem that I have boiled down to a very simple example. I have a user control that displays a some data from a business object. On one screen I have a collection of these business...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.