部分代码:请大家看看问题出在哪?
<%@ Import namespace="System.Web.UI.HtmlControls" %>
<Script language="c#" runat="server">
public void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
saveBt.Enabled=false;
}
public void sendBt_Click(object sender, System.EventArgs e)
{
landcdhDrop1.SelectedValue="a2";
saveBt.Enabled=true;
}
</Script>
<html>
.....
<asp:Button id="sendBt" runat="server" Text="发 送"></asp:Button>
<asp:Button id="saveBt" runat="server" Width="64px" Text="保存"></asp:Button>
.....
<asp:dropdownlist id="landcdhDrop1" runat="server" size="1">
<asp:ListItem Selected="True" value="a1">a1</asp:ListItem>
<asp:ListItem value="a2">a2</asp:ListItem>
<asp:ListItem value="a3">a3</asp:ListItem>
<asp:ListItem value="a4">a4</asp:ListItem>
</asp:dropdownlist>
...
</html>
<%@ Import namespace="System.Web.UI.HtmlControls" %>
<Script language="c#" runat="server">
public void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
saveBt.Enabled=false;
}
public void sendBt_Click(object sender, System.EventArgs e)
{
landcdhDrop1.SelectedValue="a2";
saveBt.Enabled=true;
}
</Script>
<html>
.....
<asp:Button id="sendBt" runat="server" Text="发 送"></asp:Button>
<asp:Button id="saveBt" runat="server" Width="64px" Text="保存"></asp:Button>
.....
<asp:dropdownlist id="landcdhDrop1" runat="server" size="1">
<asp:ListItem Selected="True" value="a1">a1</asp:ListItem>
<asp:ListItem value="a2">a2</asp:ListItem>
<asp:ListItem value="a3">a3</asp:ListItem>
<asp:ListItem value="a4">a4</asp:ListItem>
</asp:dropdownlist>
...
</html>
解决方案 »
- 页面内容导出到word模板
- 请问如何弹出提示信息
- 与web页面不在同一目录的图片不能在此web页面中显示。
- 为什么这用System.Web.Mail发邮件,在OutLook可以看到正文,而登陆到网页的邮箱正文看不到,我的邮箱是163的
- 继承和接口
- css问题(无法加载)
- server.Transfer 方法在Page_Load中好用,在button的click事件怎么就不好用了。
- 用存储过程分页,如何实现?
- !!! 传参数的问题 !!!
- ASP.NET 所有模块都做好了!就是这个主页到底怎么做?完全没思路。万分感谢!
- asp.net 中的datagrid 中绑定button(删除按钮),怎么才能点击探出确认和取消的对话框?
- 一个很简单的问题,有点急~~
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click是不是你後面少了點什麼
onClick="sendBt_click">这个行不通,已经试过了
<HTML>
<Script language="c#" runat="server">
public void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
saveBt.Enabled=false;
}
public void sendBt_Click(object sender, System.EventArgs e)
{
landcdhDrop1.SelectedValue="a2";
saveBt.Enabled=true;
}
</Script>
<form runat=server>
<asp:Button id="sendBt" runat="server" Text="发 送" onclick="sendBt_Click"></asp:Button>
<asp:Button id="saveBt" runat="server" Width="64px" Text="保存"></asp:Button>
<asp:dropdownlist id="landcdhDrop1" runat="server" size="1">
<asp:ListItem Selected="True" value="a1">a1</asp:ListItem>
<asp:ListItem value="a2">a2</asp:ListItem>
<asp:ListItem value="a3">a3</asp:ListItem>
<asp:ListItem value="a4">a4</asp:ListItem>
</asp:dropdownlist></form>
</HTML>
试一下
谢谢大家
原因是你打开aspx也面的时候把程序自动注册的button事件取消了你可以双击button还可以在load中自己注册事件