DropDownList SelectedIndexChanged事件

lzhdj 2009-11-27 04:13:49
按钮中添加 this.DropDownList2.SelectedIndex += 1;

DropDownList2_SelectedIndexChanged 不触发。这是为何?

DropDownList2 的AutoPostBack已经为 True


另外大家有没什么方法用js判断GridView模板列的TextBox值是否为空啊?是否要遍历GridView的行呢?
...全文
350 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanhui7725 2012-01-06
  • 打赏
  • 举报
回复
同样的问题
Lovely_baby 2009-11-27
  • 打赏
  • 举报
回复
GridView若是有多个textbox的话:
绑定的时候:
<table width="100%" class="ListTable" cellpadding="0" cellspacing="1" id="ListTable">
<input type="text" value='<%# DataBinder.Eval(Container.DataItem, "intID") %>'
id="IDs" name="IDs">
</table>
判断:
<input class="button" onclick="SelAllCheck('ListTable');" type="button" value=" 全 选 ">
function SelAllCheck(tabID) {
var Tab = document.all(tabID);
if (Tab == null)
return;
var chks = Tab.all.tags("input");
if (chks == null)
return;
if (chks.length) {
for (i = 0; i < chks.length; i++) {
if (chks[i].type == "text"&&chks[i].length>0) {
return true;
}
}
}
else if (chks.type == "checkbox""&&chks[i].length>0) {
return true;
}
}
lei19890721 2009-11-27
  • 打赏
  • 举报
回复
首先DropDownList2要获取一个值吧
把获取值的方法写到 if (!Page.IsPostBack) 里面看看
zhujiazhi 2009-11-27
  • 打赏
  • 举报
回复
另外大家有没什么方法用js判断GridView模板列的TextBox值是否为空啊?是否要遍历GridView的行呢?

如果只有一列是textbox,可以这样的
var options = document.getElementById("gridviewid").getElementByTagName("input");
for(var i = 0; i < options.length; ++i)
{
if(options[i].value.length == 0)
{//为空
}
}
zhujiazhi 2009-11-27
  • 打赏
  • 举报
回复
按钮中添加 this.DropDownList2.SelectedIndex += 1;

DropDownList2_SelectedIndexChanged 不触发。这是为何?

DropDownList2 的AutoPostBack已经为 True

这样是不会触发的,在WINFORM下倒是会的

62,263

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧