By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Show/Hide something in Usercontrol? How to?

P: n/a
Hello,

I have a user control that contains a table, and some text fields. I would
like to show or hide a particular row of this table, based on a selection
the user makes on my page.

Here's the situation...I have a page that has some panels that are hidden.
The first panel is visible...the user selects a city, and presses submit.

The next panel is made visible, and in this panel I have placed a user
control.

If the user selected San Francisco as their city in the first panel, I want
my user control to show a particular row of the table. If they have not
selected San Francisco, then I don't want that row in my user control to
show up for the user to see.

Is there an elegant way to do this?

Thanks for the help!

Lynn
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Lynn,

Any server-side control have the visible property... maybe you can use it ?
If the control have a view state the visible will be keep during postback.

If you need to hide full html table, just make it server side.

------------ on aspx code

<table id="tableToHide" runat="server">
<tr><td>
......
</td></tr>
----------- on code behind

Dim tableToHide As HtmlControls.HtmlTable

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

tableToHide.Visible = False

End Sub

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada
"Lynn" <yeltnab1@_NOSPAM_hotmail.com> wrote in message
news:bq********************@comcast.com...
Hello,

I have a user control that contains a table, and some text fields. I would
like to show or hide a particular row of this table, based on a selection
the user makes on my page.

Here's the situation...I have a page that has some panels that are hidden.
The first panel is visible...the user selects a city, and presses submit.

The next panel is made visible, and in this panel I have placed a user
control.

If the user selected San Francisco as their city in the first panel, I want my user control to show a particular row of the table. If they have not
selected San Francisco, then I don't want that row in my user control to
show up for the user to see.

Is there an elegant way to do this?

Thanks for the help!

Lynn

Nov 19 '05 #2

P: n/a
Hi JC,

I have tried this code, and I am getting an error..
"Object reference not set to an instance of an object. "

Line 24:
Line 25: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Line 26: myTable.Visible = False
Line 27: End Sub
Line 28:

I have Dim myTable As HtmlControls.HtmlTable in my code behind page...

Any idea what I would be doing wrong?

Thank you,

Lynn

"Jc Morin" <mi****************@jcmorin.net> wrote in message
news:OK**************@tk2msftngp13.phx.gbl...
Hi Lynn,

Any server-side control have the visible property... maybe you can use it ? If the control have a view state the visible will be keep during postback.

If you need to hide full html table, just make it server side.

------------ on aspx code

<table id="tableToHide" runat="server">
<tr><td>
.....
</td></tr>
----------- on code behind

Dim tableToHide As HtmlControls.HtmlTable

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

tableToHide.Visible = False

End Sub

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada
"Lynn" <yeltnab1@_NOSPAM_hotmail.com> wrote in message
news:bq********************@comcast.com...
Hello,

I have a user control that contains a table, and some text fields. I would like to show or hide a particular row of this table, based on a selection the user makes on my page.

Here's the situation...I have a page that has some panels that are hidden. The first panel is visible...the user selects a city, and presses submit.
The next panel is made visible, and in this panel I have placed a user
control.

If the user selected San Francisco as their city in the first panel, I

want
my user control to show a particular row of the table. If they have not
selected San Francisco, then I don't want that row in my user control to
show up for the user to see.

Is there an elegant way to do this?

Thanks for the help!

Lynn


Nov 19 '05 #3

P: n/a
JC,

Got it...needed to have my dim as a protected variable.

Thanks...Lynn

"Jc Morin" <mi****************@jcmorin.net> wrote in message
news:OK**************@tk2msftngp13.phx.gbl...
Hi Lynn,

Any server-side control have the visible property... maybe you can use it ? If the control have a view state the visible will be keep during postback.

If you need to hide full html table, just make it server side.

------------ on aspx code

<table id="tableToHide" runat="server">
<tr><td>
.....
</td></tr>
----------- on code behind

Dim tableToHide As HtmlControls.HtmlTable

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

tableToHide.Visible = False

End Sub

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada
"Lynn" <yeltnab1@_NOSPAM_hotmail.com> wrote in message
news:bq********************@comcast.com...
Hello,

I have a user control that contains a table, and some text fields. I would like to show or hide a particular row of this table, based on a selection the user makes on my page.

Here's the situation...I have a page that has some panels that are hidden. The first panel is visible...the user selects a city, and presses submit.
The next panel is made visible, and in this panel I have placed a user
control.

If the user selected San Francisco as their city in the first panel, I

want
my user control to show a particular row of the table. If they have not
selected San Francisco, then I don't want that row in my user control to
show up for the user to see.

Is there an elegant way to do this?

Thanks for the help!

Lynn


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.