大家好,
想问个问题,在asp.net中如何检验listview中的行是否被选择上?
画面上有个listview 控件,还有个button控件,想要实现listview的行被选择上,按button弹出各自定义的popup确认框
如果listviewz的行没有被选择上,则提示错误信息。listview的行应该是可选择的状态。下面的做法,当显示错误后,整个listview都不能被选择了 <asp:Button ID="btnSubmit" runat="server" Text="登陆" Width="100px" OnClientClick="return showConfirm(this,'RestroeConfMsg');" onclick="btnSubmit_Click" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidationRowSelect"
ErrorMessage="CustomValidator"></asp:CustomValidator> <input type="hidden" id="RowSelected" value="<%=_RowSelected%>" /> <script type="text/javascript"> ValidationRowSelect(){
if (document.getElementById('RowSelected').value ==-1){
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
</script>c#
protected bool _RowSelected =-1;
protected void Page_Load(object sender, EventArgs e)
{ protected void RestoreView_SelectedIndexChanged(object sender, EventArgs e)
{
int index=RestoreView.SelectedIndex;
_RowSelected = index;
想问个问题,在asp.net中如何检验listview中的行是否被选择上?
画面上有个listview 控件,还有个button控件,想要实现listview的行被选择上,按button弹出各自定义的popup确认框
如果listviewz的行没有被选择上,则提示错误信息。listview的行应该是可选择的状态。下面的做法,当显示错误后,整个listview都不能被选择了 <asp:Button ID="btnSubmit" runat="server" Text="登陆" Width="100px" OnClientClick="return showConfirm(this,'RestroeConfMsg');" onclick="btnSubmit_Click" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidationRowSelect"
ErrorMessage="CustomValidator"></asp:CustomValidator> <input type="hidden" id="RowSelected" value="<%=_RowSelected%>" /> <script type="text/javascript"> ValidationRowSelect(){
if (document.getElementById('RowSelected').value ==-1){
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
</script>c#
protected bool _RowSelected =-1;
protected void Page_Load(object sender, EventArgs e)
{ protected void RestoreView_SelectedIndexChanged(object sender, EventArgs e)
{
int index=RestoreView.SelectedIndex;
_RowSelected = index;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货