473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 18 '05 #1
3 4716
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 18 '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 18 '05 #3
It turned out to be the autopostback setting. thx to all who replied!
Nov 18 '05 #4

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

Similar topics

3
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
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
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
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
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...
12
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
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...
3
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...
4
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...

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.