【发布时间】:2014-12-17 22:29:38
【问题描述】:
我一直在编写一个小型网站,它对数据库进行检查,然后创建一堆自定义按钮,当点击这些按钮时,它们会重定向到不同的本地 IP 地址。
到目前为止,我已经让中继器填充并显示网站上的按钮,但尽我所能,我无法让网站重定向甚至触发 on_click 事件。
这是我目前所拥有的相关内容
<script runat ="server">
Sub Button_Click()
TextBox1.Text = "test"
Response.Redirect("http://www.musicsystems.com")
End Sub
</script>
<style>
.ams-button {
border: 0;
cursor: pointer;
height: 60px;
line-height: 60px;
margin: .25em;
margin-left: .5em;
position: relative;
}
.ams-button-edge {
border: 0;
float: left;
height: 60px;
line-height: 60px;
margin: 0;
padding: 0;
max-width: 30px;
min-width: 30px;
width: 30px;
}
.ams-button-left {
background: url(Content/images/z1/parts/left.png) no-repeat center center;
}
.ams-button-middle {
background: url(Content/images/z1/parts/middle.png) repeat-x center center;
border: 0;
float: left;
height: 60px;
line-height: 60px;
margin: 0;
padding: 0;
max-width: 11em;
min-width: 11em;
width: 11em;
}
.ams-button-right {
background: url(Content/images/z1/parts/right.png) no-repeat center center;
}
.ams-button-text {
color: #fff;
font-size: 15px;
font-weight: bold;
height: 50px;
line-height: 50px;
margin: 0 21px;
overflow: hidden;
text-align: center;
vertical-align: middle;
white-space: nowrap;
}
</style>
<form id="form1" runat="server" onclick="Button_Click()">
<asp:Repeater ID="btnlist" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div title="<%#Container.DataItem(1)%>" class="ams-button" >
<div class="ams-button-edge ams-button-left"></div>
<div class="ams-button-middle" >
<div class="ams-button-text" runat="server" ><%#Container.DataItem(0)%></div>
</div>
<div class="ams-button-edge ams-button-right"></div>
</div>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</form>
任何人的帮助将不胜感激
【问题讨论】:
标签: html asp.net vb.net webforms repeater