使面板可见和不可见。 [英] Make panels visible and invisible.

查看:93
本文介绍了使面板可见和不可见。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


i在ASP.net / VB页面中有5个面板。

面板1可见,其他4个不可见。


我还有5张图片:图片1,图片2,...,图片5.


当我点击其中一张图片时,图片N,面板N变得可见并且

所有其他看不见。


你能告诉我脚本是怎么样的,图像代码怎么样? br />
是吗?


谢谢,

Miguel

解决方案

嗨Miguel。


你在很多小组中使用多个帖子并且没有跟进你以前的

消息,你想要这么好吗?下次交叉,比我们看到

其他组中的答案是什么。


交叉发送一条消息给更多新闻组用逗号分隔

他们。


谢谢,


Cor


< blockquote> Hi Miguel,

我假设在哪里以及其他问题,


这里有一个示例如何做你要求的事。


我希望这有帮助吗?


Cor

\\\

Private Sub Page_Load(ByVal sender As System.Object, _

ByVal e As System.EventArgs)处理MyBase.Load

如果不是IsPostBack那么

viewstate.Item(" T")= 1

结束如果

Dim frm As Control = Me.FindControl(" Form1")

Dim ctl As Control

For each ctl in frm.Controls

如果TypeOf ctl是Panel那么

DirectCast(ctl,Panel).Visible = False

结束如果

下一页

结束子

私人子按钮1_Click(ByVal发送者为System.Object,_

ByVal e As System.EventArgs)处理Button1.Click

选择案例viewstate.Item(" T")

案例1

Panel1.Visible =真

案例2

Panel2.Visible = True

案例3

Panel3.Visible = True

案例4

Panel4.Visible = True

案例5

Panel5.Visible = True

viewstate.Item(" T")= 0

结束选择

viewstate。项目(T)= CInt(viewstate.Item(" T")))+ 1

End Sub

///

你好Cor,


i在使用Handles ...时总是有问题。

不知道为什么。


我一直在看ASP.net脚本一个月。我知道我只是

开始,但每次有人帮我出去并发给我一些像这样的代码

i最终在墙上撞到我的脑袋:-)


你能给我发一个简单的ASP.net文件,里面有2个面板,2个图像和这个

代码,所以我可以查看这是如何实现的。

如果您可以发送给我,请使用我的电子邮件,但从

地址购买NoSpam。


谢谢,

Miguel


" Cor Ligthert" <无********** @ planet.nl>在消息中写道

news:#b ************** @ tk2msftngp13.phx.gbl ...

Hi Miguel,

我假设在哪里以及其他问题,

这里有一个示例如何做你要求的。

我希望这有帮助吗?私有Sub Page_Load(ByVal sender As System.Object,_
ByVal e As System.EventArgs)处理MyBase.Load
如果不是IsPostBack那么
viewstate.Item(" T")= 1
结束如果
Dim frm As Control = Me.FindControl(" Form1")
Dim ctl作为控制
对于每个ctl在frm.Controls
如果TypeOf ctl是Panel然后
DirectCast(ctl,Panel).Visible = False
结束如果
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,_
ByVal e As System.EventArgs)处理Button1.Click
Select Case viewstate.Item(" T")
案例1
Panel1.Visible = True
案例2
Panel2.Visible = True
案例3
Panel3 .Visible = True
案例4
Panel4.Visible = True
案例5
Panel5.Visible = True
viewstate.Item(" T")= 0 <结束选择
viewstate.Item(" T")= CInt(viewstate.Item(" T")))+ 1
End Sub
///



Hello,

i have 5 panels in an ASP.net / VB page.
The panel 1 is visible the other 4 are NOT visible.

I also have 5 images: image 1, image 2, ..., image5.

When i click one of the images, image N, the panel N becomes visible and
all the other invisible.

Can you tell me how shoudl the script be and how should be the image code
be?

Thank You,
Miguel

解决方案

Hi Miguel.

You multipost in a lot of groups and does not follow up your previous
messages, do you want to be so kind to crosspost next time, than we can see
what where the answers in the other groups.

crossposting sending one message to more newsgroups with a comma to seperate
them.

Thanks,

Cor


Hi Miguel,

I assume that where as well the other questions,

Here a sample how to do what you ask.

I hope this helps?

Cor
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
viewstate.Item("T") = 1
End If
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is Panel Then
DirectCast(ctl, Panel).Visible = False
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Select Case viewstate.Item("T")
Case 1
Panel1.Visible = True
Case 2
Panel2.Visible = True
Case 3
Panel3.Visible = True
Case 4
Panel4.Visible = True
Case 5
Panel5.Visible = True
viewstate.Item("T") = 0
End Select
viewstate.Item("T") = CInt(viewstate.Item("T")) + 1
End Sub
///


Hi Cor,

i allways have problems in making things work when this Handles... is used.
Have no idea why.

I have been looking at ASP.net scripts for a month. I know i am just
starting but everytime someone helps me out and sends me some code like this
i end up hitting my head in the walls :-)

Could you send me a simple ASP.net file with 2 panels, 2 images and this
code, so i can check how is this implemented.
If you can send it to me please use my email but take the NoSpam from the
address.

Thank You,
Miguel

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:#b**************@tk2msftngp13.phx.gbl...

Hi Miguel,

I assume that where as well the other questions,

Here a sample how to do what you ask.

I hope this helps?

Cor
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
viewstate.Item("T") = 1
End If
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is Panel Then
DirectCast(ctl, Panel).Visible = False
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Select Case viewstate.Item("T")
Case 1
Panel1.Visible = True
Case 2
Panel2.Visible = True
Case 3
Panel3.Visible = True
Case 4
Panel4.Visible = True
Case 5
Panel5.Visible = True
viewstate.Item("T") = 0
End Select
viewstate.Item("T") = CInt(viewstate.Item("T")) + 1
End Sub
///



这篇关于使面板可见和不可见。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆