Why panel control appear behind of the another control? - c#

I wrote a functionality to open the panel when we click on the textbox. But the panel appears behind the other controls. The entire code should be written in C#, ASP.NET. Can anyone help me out with this?
Click here to see the reference image
When I click on the "Dev Root Cause" text box, the panel should appear before the dropdown control. But it appears on the back side of the control.
When we click on the TextBox, one panel appears with the multi-checkbox list. But this should be appear before other controls.

Related

Buttons changing Tabs

I want to make buttons change Tabs but i want the tabcontrol to be invisible (Only the page visible not the tabcontrol buttons).
I have 2 buttons Home and Settings and when the Form starts the Home page is visible and when the user clicks Settings button it changes to the Settings page and the same goes for Home button.
So what i need is for the Home and Settings tab buttons to be invisible and i want to only be able to use the buttons i created to change the pages. Hope someone understands. I use Visual Studio 2015 and C#.
Going by the name of your control (TabControl1) I am assuming this is WinForms.
You can achieve what you are describing without using a tab control at all, just move the contents of each of your tabs to seperate UserControls and then swap the visibility or positioning (or both) upon each button click.
For Home button click handler:
settingsUserControl.Visible = false;
homeUserControl.Visible = true;
Then repeat the reverse, in the Settings button click handler.
If you are using TabControl for its border, then use a Panel as a container to the UserControls.
In fact, this is similar to how Tab Controls worked in VB6, the control being hidden would be shoved 30,000 Twips off to the left, outside the view port of the tab control.

why are new controls showing up in my form AND panel

i have a form with a few controls on it, i have a panel with different controls on, That panel is above the form controls.
i have added new controls to the form and when i place the panel back over the form, the new controls are showing through the panel itself, but only the new one controls and not the "old" ones, if i copy and paste a control or add a new one it has the same effect.
i have looked in the designer.cs and the new controls are being added to the form and NOT to the panel itself.
this is weird and iv checked various properties but cannot immediately see the reason for this.
i have made MANY forms before and this is the 1st time this is happening.
one the note of controls, is there a way to change the default value of the labels "AutoSize" property from TRUE to FALSE; i'm using visual studio CE2015
any ideas on what to check? im really stumped by this one.
As mentioned in the comments, you need to check the z-order of your controls.
In the picture below you can see a form I created with two buttons and a panel as you were describing. Neither button is one the panel, however button 3 has a z-order that puts it on top, just as the panel is on top of button 2
If you right click on the controls you want to change the z-order of you see Bring to Front and Send to Back. Choose the appropriate option.

c# windows form Tab Order

I have a windows form in C# project that keeps Student Info. I caught the image:
I want to add data with sequential order as follows but when I enter data to Surname textbox, TAB button jumps to E-Mail textbox, then Phone Number textbox and lastly to Date of Birth DateTimePicker.
I made all control's TabStop property "False" on the form except these textboxes. And I arranged their TabOrder via Properties Section as follows 0,1,2.. as I intented. But the order followed as I wrote above. Then I opened Tab Order function via "View" on menu strip.. I clicked all controls which I wanted to use in order, but no use. The form and Tab button act as before. I caught Tab Order function image below:
What shall I do now?
TabIndex is important for controls which are siblings of the same parent. However, if your TextBox and ComboBox controls are each inside different parents then their parent controls must have the proper TabIndex.
In the Windows Forms Designer you can see which controls are children of which panels by bringing up the Document Outline. Go to View -> Other Windows -> Document Outline.
If each TextBox or ComboBox is directly inside a parent then its TabIndex doesn't matter, it can be 0. It's the parent (and possibly the parent's parent's) TabIndex which needs to be in order.
Now that we have VS 2019. Simply go to form.cs[design], click "View" tab at the top of the page and select "Tab Order". This will allow you to click on the form elements in order of which you want them to be tabbed to. Any items not selected will not be tabbable(I think I made this word up). Once complete, click "Tab Order" again to exit view.

Triggering UpdatePanel on a button contained within a UserControl situated on the webpage

I would like an UpdatPanel to update it's content once a button is clicked - this button is contained within a UserControl placed on the webpage.
However, I cannot just simply reference it using the AsyncPostBackTrigger's ControlID property, because the button is not situated directly on the webpage.
Is there any way to reference it to the AsyncPostBackTrigger?
Use RegisterAsyncPostbackControl, e.g. if you have a user control UserControl1 containing Button1 and your script manager is called ScriptManager1:
ScriptManager1.RegisterAsyncPostbackControl(UserControl1.FindControl("Button1"));
Edit:
This will refresh all update panels, except panels that have their property set to conditional. For these panels you need to call UpdatePanel.Update(); in the code for the button.
Does the user control expose the button as a child control? If not can it? If not then you can use FindControl on the user control to find the inner button.

Why are controls within custom panel (C# winforms) disappearing in designer?

I have been able to create a custom C# winforms control that is basically a panel with a fixed banner (header/footer). I want to base other user controls on this "banner panel". I've gotten past the problem with the designer here. I can successfully add controls to the inner content panel. Everything looks fine while designing. However, when I recompile, the controls I added to the content panel disappear. They are still there (in code) but aren't displayed in the designer. Is there any thing that I need to do to set the drawing order of the controls?
Your controls are still nested correctly within the panel control, they have just lost their z-order. If you choose the controls from the property panel and right click on the control border that appears within the parent panel and select "Bring To Front" from the layout toolbar, your nested controls will re-appear. I don't know why it does this, but a workaround is to bring all child controls to the front during control initialization in the code.
There is really nothing to go on here without src. What I would do is to comment everything out including in the InitializeComponent function but a widget in the middle panel and run. Do whatever it takes to get that one widget to show. Inherit from UserControl instead of the banner panel.
Then comment in each piece until the widget no longer comes up. That is what is causing your problems. Once it all comes up properly, then you make sure the designer portion of the src works. It is going to potentially be a long process.

Categories