【发布时间】:2015-08-13 11:18:37
【问题描述】:
我创建了一个user control,它下面有一个asp:Image 和一个asp:Label,最后一个标签下面还有一个asp:Label。我希望这个用户控件的行为完全像一个按钮,这意味着我们有一个包含图像和两个标签的框,当用户点击这个框上的每个点时,它就像一个按钮并根据它的点击事件做任何事情。
谁能帮帮我?
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="room.ascx.vb" Inherits="room" %>
<style type="text/css">
.image {
width:100px;
height:100px;
margin:2px;
border:solid;
border-width:1px;
}
.text {
margin-left:2px;
margin-right:2px;
text-wrap:normal;
text-align:right
}
</style>
<asp:Panel ID="Panel" runat="server" width="106px" BorderStyle="Solid" BorderWidth="3px" BackColor="Wheat">
<asp:Image ID="img" runat="server" CssClass="image" /> <br />
<asp:Label ID="name" runat="server" Text="name" Width="100px" CssClass="text" /> <br />
<asp:Label ID="price" runat="server" Text="Label" Width="100px" CssClass="text" /> <br />
</asp:Panel>
【问题讨论】:
-
您可以处理客户端点击事件,然后手动发起回发。
__doPostBack('Panel','')