473,386 Members | 1,674 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.

Show and hide a usercontrol (codebehind)

Is it possible to show/hide a usercontrol code behind?
<uc1:topart id="Topart1" runat="server"></uc1:topart>
This is what i want to do, but this does not work:

if objDR.read
me.Topart1.show 'Show usercontrol if datareader.read
else
me.Topart1.hide 'Hide usercontrol
end if
Thanks for your tips!!!
Jan 24 '06 #1
2 3794
JDP
When I want to display different datagrids or fields, rather than create or not,
I place the controls in panels

<asp:Panel....

I then enable or disable the visiblity of the panel that contains the UC.

I've created wizards this way and even forms using a table that has panels in
the cells.

I've even used the <tr> as <asp:TR> and have two sProcs exec, one for the UI and
the other for the data.

Certain rows w/in my table are referenced in the UI sProc and stored in SQL.

This also gives me the abilty to build an Admin interface for the cotrols that
doesn't require a build.

I can then hide a row that has say 2 cells, lable and form field that is not
supposed to conditionally disply for a certain record types.

HTH

JeffP....

"Øyvind Isaksen" <oy****@sorenso.no> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is it possible to show/hide a usercontrol code behind?
<uc1:topart id="Topart1" runat="server"></uc1:topart>
This is what i want to do, but this does not work:

if objDR.read
me.Topart1.show 'Show usercontrol if datareader.read
else
me.Topart1.hide 'Hide usercontrol
end if
Thanks for your tips!!!

Jan 24 '06 #2
Dan
Hi

I think J gave you way more than you need and slightly veered from a simple
hide/show.

Yes it can be done, i am a c# man but i can't see the code being very diff,
you simply set the components Visible flag to false.

First check that it does vanish by simply running the code with no if
statement, then put in the if statement. Or set a breakpoint inside it to
ensure the partt hat hides it is being called. It may well be that and not
your flag setting.

Hope that helps

--
Dan
"Øyvind Isaksen" <oy****@sorenso.no> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is it possible to show/hide a usercontrol code behind?
<uc1:topart id="Topart1" runat="server"></uc1:topart>
This is what i want to do, but this does not work:

if objDR.read
me.Topart1.show 'Show usercontrol if datareader.read
else
me.Topart1.hide 'Hide usercontrol
end if
Thanks for your tips!!!

Jan 24 '06 #3

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

Similar topics

2
by: bill yeager | last post by:
When trying to run my web project, I get the following error: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the...
2
by: crjunk | last post by:
I have a droped a UserControl named "ReceivedRecord1" onto my web form. Currently, I have been saving information typed in by the user with the following code that is located in the CodeBehind...
4
by: Mat | last post by:
Hi, I am having a bit of a problem trying to access / set properties of a usercontrol from the parent codebehind. This is what I have so far.. simple.aspx <%@ Page...
6
by: Pete Davis | last post by:
I'm fairly weak with ASP.NET. What I'm trying to do is pass an attribute to a UserControl. The attribute is a value from the CodeBehind for the page. So in my .aspx I have the following: ...
0
by: N. Demos | last post by:
Hello, I have a custom usercontrol, of which I have two instances of in my aspx page. Both the usercontrol and page have codebehind. In the page codebehind, I want a member variable for each...
2
by: Joanne | last post by:
Hi, I have an "interesting" problem with UserControls in a datagrid and I'm desperate for your help as I work alone and have no-one else to ask. It is quite complicated but I'll try to keep it...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
14
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of that control on a Page ("Defaul.aspx"). The control works fine. Now, I want to be able to use "FindControl()" from...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.