Setting a panel control's visibility and it's affect in nested controls.

I am trying to debug a page using the panel control.  The code in the final submission of the form has logic to get data from a dropdown based on the control's visibility.  If the control's visibility is set to true, the the data is retrieved and sent to the database.

The problem appears to be the dropdown control's visibility is set to false when it should not.  The dropdown is nested in a panel control.  While doing a trace, it appears when a panel control's visibility is set to false, the visibility for all controls nested under this panel are set to false as well.

You're probably asking why use a control's visibility as a condition on what to do with the data.  The answer is I didn't write this page and I intend to change the logic. 

Can anyone confirm that when setting the panel control's visibility, you also set the visibility of any nested controls?

Thanks,

Mike 

0
owen912
11/9/2006 3:31:54 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

2 Replies
900 Views

Similar Articles

[PageSpeed] 8

Yes it will set all the child controls visibility to false..

Think of it this way.. when you are hiding a container.. all the contents will be hidden too.. Here the panel is nothing but a container.. so the contents, which are the child controls will be hidden too when its container is hidden


Kumar Reddi
0
Kumar
11/9/2006 6:42:39 PM
Thanks.  I've used panels before to hide controls based on certain conditions.  Until now I had not realized when setting the visibility of the container you're setting that state to all the child controls.
0
owen912
11/10/2006 10:18:27 AM
Reply:

Similar Artilces:

Setting a panel's height to the height of it's parent control
How do I go about getting a panel to be the same height and width of the cell of the GridView or table that it is in?  I was under the impression that if you set the height of the panel to be 100%, then it would become 100% of the parent control.  In this case, I would assume that the parent control would be the cell that it is housed in. When I do this, it makes my entire GridView or table (I've tried both) grow in heighth by a dramatic amount.  I just want the panel to be the same height as the cell when they are each at their minimum height (based on the lines of text ...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

OLE Control
I'm attempting to load a .bmp image into an OLE object using PowerBuilder 11.1. The OLE ActiveX is AddFlow5 and I am using it to graphically represent links between entities - people, organisations, addresses, vehicles, telephones, etc. Documentation for AddFlow5 gives an example in VB script to load the relevant 'picture' into a node, ie, SET node.picture = LOADPICTURE("C:\images\person.bmp"). I cannot find a suitable equivalent in PB 11 to either 'SET' or to 'LOADPICTURE' The developer of AddFlow suggested I try: OLEObject uo uo = C...

how to control a RadioButtonList's Listitem's text show according database's field
Hi my page has a repeater control,in repeater has a RadioButtonList control now i want to let the RadioButtonList has four Listitem,every Listitem's text is a database's field so the listitem can show dynamic according every record how can i work out my problem thanks a lot  hello dearbound your RadioButtonList to database if i m not clear fell free 4 replySatyabrat SinghB.E.(C.Sc.)Web developer Livetek Solution Dont forget to click "Mark as Answer" on the post that helped you. yes.i bound the radiobuttonlist to a dataset but how to display the ...

'Tab' control 's visible doesn't work.Why?
I use tab control in my applition. And I set visible=false, but it doesn't work. my code is: ----------------------------------------------- <asp:ScriptManager ID="ScriptManager1" runat="server" />  <div>   <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="138px" ActiveTabIndex="0"    Width="402px">    <ajaxToolkit:TabPanel runat="server" ID="Panel1" HeaderText="Tab1" Visible="f...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

how to let ButtonColumn control button's visible's property in DataGrid
Hi I has a ButtonColumn in a DataGrid,and a button in the page, In the page_load() event i wrote: if (Not IsPostBack) then   button1.visible=false end if and the ButtonColumn CommandName="delete" in the DataGrid1_delete() event i wrote   button1.visible=true But when i press the "delete" ButtonColumn ,the button1 can not be visible,i don;t why How can when i press "delete" ButtonColumn,the Button1 can be visible Thanks a lot.       yugiant:How can when i press "delete" ButtonColumn,the Button1 can be visibl...

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Can a User Control's Page_Load retrieve a value set in the parent's Page_Load?
I want to use a control to perform a specific task, but I want it to vary based on the page it is on. I was hoping to set a value in the Page_Load event of the Parent, and have that value retrieved by the Page_Load event of the user control. I am not sure what order these events fire in, Can I be certain that the parent event will fire first?...

Rating Control: cannot set currentrating in page's onload event if control is not initially visible
I have a page which contains a rating control which is initially hidden.  On the initial page load (!Page.PostBack) the CurrentRating property is set to 2.  When the page posts back the rating control is made visible, but CurrentRating property has no value.  It loses the value 2.  If the rating control is initially visible the CurrentRating is set properly and maintained properly across postbacks.  The same problem occurs if you include the rating control in a view that is not initially active in it's multiview.<atlastoolkit:rating id="rat...

Getting 'System.Web.UI.Control' does not contain a definition for 'DataItem' error on controls when placed inside an update panel which is in a template.
Using the June CTP, I;ve got an updatepanel inside the itemtemplate of a datalist which is now suppopsed to be supported (it works). I also have some asp controls (imagebutton, label) which get their values dynamically (DataBinder.Eval(Container.DataItem, "fieldname").ToString(). This would work fine before putting the updatepanel in the datalist itemtemplate, I now get the error in the title when building ('System.Web.UI.Control' does not contain a definition for 'DataItem') for each control... How can I dynamically assign the values to the controls in the datalist when also using upd...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

Control's (object's) default value??
How or where can I see an asp.net control's default value? Say, for example the Visible property for webcontrols? Would be preferable if I could quickly see it in Visual Web Developer but MSDN online documentation would also be nice. Also how can I do this in general for all .Net objects?...

Modify Web Control in Function by Passing in Web Control's ID as Parameter
Good day to all, I am trying to modify web controls through functions by passing in their ID as the parameter so that I can call the function whether a control's properties need to be modify. The rough idea I have is as follows: (Function, In VB) Function ModifyTextboxText(Byval SampleTextbox) SampleTextBox.text = "Textbox contents changed." End function (Calling the function) ModifyTextboxText(MyTextbox.id) Has anyone got any idea how I could proceed with the coding? Appreciate any help around here. Its for my school project. Thanks!...

Replace 1's and 0's in a gridview column with Yes's and No's
Is it possible to change the display of a column in a gridview to show a Yes for all 1's and a No for 0's that display in a particular column of a gridview bound to a database?  If so, can someone share the way with me?  I am using ASP.NET 2.0 with VB Code Behind.  Thanks One way you can do is thrrough  CASE in your select statement: Select YesNoColumn= CASE yourColumn WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' ELSE '' END FROM YourtableLimno <Columns>     <asp:TemplateField HeaderText="yourHeader" SortExpression="yourDataField"> ...

It's Linux !? No, it's BSD ! No, no, it's...
kFreeBSD http://wiki.debian.org/Debian_GNU/kFreeBSD a Debian distro using the FreeBSD kernel ! ObiWan wrote: > kFreeBSD > > http://wiki.debian.org/Debian_GNU/kFreeBSD > > a Debian distro using the FreeBSD kernel ! Why use a BSD kernel? I hope the reason is more than, just because they can. http://wiki.debian.org/Debian_GNU/kFreeBSD_why It's easy to understand why the would want to use Debian packages. :) -- Jimmy Johnson Registered Linux User #380263 >> kFreeBSD >> >> http://wiki.debian.org/Debian_GNU/kFreeBSD >> ...

Access Web Control's property within the Web Form
Hello, I have a Web Control which has a TextBox and a Button. I want to put this Control on a WebForm, then put some text in a Control's TextBox, press on Control's Button and be able to access text box's value from within the Web Form. That's my Control: _________________________________________________ public class Colo : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Button Button1; public string Myval{ get{return (string)ViewState["myval"];} set{ViewState["myval"] = va...

Remove Control's ViewState when it's no longer needed
To improve performance, is it possible to remove a control's ViewState values when they will no longer needed?I've tried setting EnableViewState to false once the control will no longer be appearing, but this doesn't seem to reduce the ViewState's size. FYI if a control is hidden it does not have its value in ViewState.Long Live .NETKazi Manzur Rashid (Amit)_________________________Web: http //dotnetshoutout.comBlog: http://weblogs.asp.net/rashidTwitter: http://twitter.com/manzurrashid  I'm not sure if this is correct, if by "hidden" you mean Visible=false.I think I ca...

Getting the recreated control's id's by viewstate?
Hi How can i get the automaticly created fileupload control's id's by stroring them in the viewstate? Is it possible? or any other way to get them on the run-time? I can store button's click number and then create dynamic controls on the run-time and if i look at the source code i can see the auto-created id's but when i click submit button to upload files in fileupload controls i get an NullReferenceException. I guess when i click submit button all the id's gone because the page posts back. So i write this to read id's and assign to my fileupload control, here is the code for it...

Is Datagrid's TemplateColumn's Inner Content limited for controls?
For some obscure reason, i can't use any type of non-builtin control inside a Datagrid's TemplateColumn.... tx 4 any info Could you give more information? Inside a templatecolumn you are able to put whatever markup you want, including server controls. Could you post part of your code and the problem you are seeing. are you sure you want me to bother you with my code? http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=299243...

accessing a datawindow's control's properties using expresisons
Is it possible to access a column's y coordinate and use it in a datawindow extression? example: if(column.y > 500, a..., b...) If( Long( Describe( 'column.Y' )) > 500, a..., b... ) -- Paul Horan[TeamSybase] VCI Springfield, MA www.vcisolutions.com "Leon Mandel" <lmandel@sao.state.tx.us> wrote in message news:3E308134.8070602@sao.state.tx.us... > Is it possible to access a column's y coordinate and use it in a > datawindow extression? > > example: > > if(column.y > 500, a..., b...) > ...

synchrosize between control's rmb menu and window's menu
hello all! I'm using PB7.03 and PFC.Now i am trying to find a good way to synchronize the menuitem status(enable/disable) between window's menu and focused editable control' right button menu. For example, a dw column with dispalyonly property now has focus and user selected some text in the column.If he(she) click right button and trigger rightbrttonmenu, the "cut" item is disabled for this is a displayonlycolumn.But if he(she) explore the window's menu he(she) will find that the "cut" menuitem is enabled. This not right,that two menu shoule be ...

Set the control's tab order in a tab control
How can I set the control's tab sequence in a tab page? Charles Right click inside the tab page, and select Tab order from the right mouse menu. Get out of tab order using the menu or toolbar. Kent Piland Charles wrote: > How can I set the control's tab sequence in a tab page? > > Charles ...

Web resources about - Setting a panel control's visibility and it's affect in nested controls. - asp.net.web-forms

Resources last updated: 2/16/2016 11:49:01 AM