473,503 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refresh controls on Panel in webform?

How do you refresh the controls on a panel?

I've got a VB webform which contains a panel. On that panel is a
checkbox and a textbox. I'd like the textbox to appear when the
checkbox is checked and disappear when the checkbox is unchecked.

My code is:

Private Sub checkBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
If checkBox1.Checked Then
textBox1.visible=False
else
textBox1.visible=True
end if
End Sub

The CheckChanged routine is being called when I check/uncheck the
checkbox. However, The TextBox doesn't disappear. The page needs to
be refreshed, but there doesn't seem to be anything like
Panel1.Refresh() or textBox.Refresh()
Nov 21 '05 #1
3 2146
Probably the checkbox control is not set to autopostback.
Or it can happen to be set on autopostback but he lost his attached event,
and you can look in properties events tag to see if the checkbox has the
event attached.

If you say that the event CheckChange is called when you check/uncheck and
your texbox doesn't dissapear try to search in your page some other possible
setting of textbox1 visibility.

And your code should be like this to see the textbox1 when your checkbox si
checked.
textBox1.visible = checkBox1.Checked;

Cheers
"*no spam*" wrote:
How do you refresh the controls on a panel?

I've got a VB webform which contains a panel. On that panel is a
checkbox and a textbox. I'd like the textbox to appear when the
checkbox is checked and disappear when the checkbox is unchecked.

My code is:

Private Sub checkBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
If checkBox1.Checked Then
textBox1.visible=False
else
textBox1.visible=True
end if
End Sub

The CheckChanged routine is being called when I check/uncheck the
checkbox. However, The TextBox doesn't disappear. The page needs to
be refreshed, but there doesn't seem to be anything like
Panel1.Refresh() or textBox.Refresh()

Nov 21 '05 #2
NoSpam,

I made a panel and on that a checkbox and a textbox.

With this code the textbox was not on the panel when the checkbox was
checked (I assume that you have set that autopostback as well).
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
CheckBox1.AutoPostBack = True
End Sub
Private Sub checkBox1_CheckedChanged(ByVal _
sender As System.Object, ByVal e As System.EventArgs) _
Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox1.Visible = False
Else
TextBox1.Visible = True
End If
End Sub
///
I hope this helps?

Cor

"*no spam*" <no*****@yahoo.com>
How do you refresh the controls on a panel?

I've got a VB webform which contains a panel. On that panel is a
checkbox and a textbox. I'd like the textbox to appear when the
checkbox is checked and disappear when the checkbox is unchecked.

My code is:

Private Sub checkBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
If checkBox1.Checked Then
textBox1.visible=False
else
textBox1.visible=True
end if
End Sub

The CheckChanged routine is being called when I check/uncheck the
checkbox. However, The TextBox doesn't disappear. The page needs to
be refreshed, but there doesn't seem to be anything like
Panel1.Refresh() or textBox.Refresh()

Nov 21 '05 #3
It turned out to be the autopostback setting. thx to all who replied!
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1605
by: keith | last post by:
I have a panel on my form and add controls (e.g. TextBox) into it at runtime. What I want is the controls will display on same line if they are visiable in the panel horizontally. If any of the...
0
1059
by: GeorgeKaz | last post by:
i have a very irriting problem that i have written a short piece of code to demonstrate. The problem is that my aspx page is not fully refreshed after an event is fired, which is delegated to an...
1
3511
by: hqdtech | last post by:
how to refresh webform from other webform I have 2 webform, i want if webform A was close then webform B wil refresh. And the problem second: how to catch packet on the network in C#. ...
3
2470
by: George K | last post by:
Hi, i have a very irriting problem that i have written a short piece of code to demonstrate. The problem is that my aspx page is not fully refreshed after an event, which is delegated to an...
2
2909
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
3
4728
by: *no spam* | last post by:
How do you refresh the controls on a panel? I've got a VB webform which contains a panel. On that panel is a checkbox and a textbox. I'd like the textbox to appear when the checkbox is checked...
12
1422
by: Aaron | last post by:
Is there a way to get the names of all of the textboxes that are placed on a panel? I have several panels on my .NET application, each with several textbox controls. I would like to get all of...
3
1507
by: Connor T | last post by:
Hi, I have a form which is dynamically generated from the contents of a Database using commands such as this: hostform.Controls.Add(aRadio) However, that adds the control to the top level...
1
1078
by: Ufit | last post by:
Asume I have panel on a webform and I created few user controls (.ascx) How do I programaticaly add my user controls to that panel so it displays them as some sort of controls list? I've tried...
4
4740
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
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
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
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
3177
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...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.