你完全可以用Server controls而不用html control,这样可能会有些问题
解决方案 »
- asp.net session失效后。。。。
- 求VS2008帮HTML减肥的正则(删掉><间的空格和换行)
- 从没遇见的DataReader错误
- 图片绑定到datalist
- 视图状态和控件状态有点迷糊。。高手来讨论下
- dataList里嵌套dataList 出错了???
- 请问如何在page以外的类里使用System.Web.HttpContext.Current.Session?
- 请问:Could not find installable ISAM.,这个问题怎么解决呢?
- 在asp.net中如何调用oracle的存储过程
- 数据连接怎么回事呢?
- 做网页时遇到的问题,请指教
- 奇怪了,我这个DATAGRID中的BUTTON控件点击了,不执行呢??源码如下.
CheckBox ckbox=(CheckBox)E.Item.FindControl("Check1");
if(ckbox!=null)
{
....
}
{
object findObj = this.dGrid.Items[i].Cells[0].FindControl("chkSel");
if( ((HtmlInputCheckBox)findObj).Checked )
{
}
}
public static int[] DgrdChkValue(DataGrid dgrd,string CheckID)
{
ArrayList array = new ArrayList(0);
HtmlInputCheckBox chk = null;
for(int i=0;i<dgrd.Items.Count;i++)
{
chk = (HtmlInputCheckBox)dgrd.Items[i].FindControl(CheckID);
if(chk.Checked)
{
array.Add(chk.Value);
}
}
int[] chkValue = new int[array.Count];
for(int i=0;i<array.Count;i++)
{
chkValue[i] = Int32.Parse(array[i].ToString());
}
return chkValue;
}
不存在你说的情况。
我用服务器端的CheckBo试过了,同样的现象。晕~~~我在Page_Load()方法中添加:
this.btnDelete.Attributes["onclick"] = "javascript:return ConfirmDelete();";
在页面的javascript中定义:
function ConfirmDelete(){
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkAll' && e.checked)
{
return true;
}
}
return false;
}
然后在cs文件中的
private void btnDel_Click(object sender, System.EventArgs e)
{
for(int i=0;i<this.dataGrid.Items.Count;i++)
{
object findObj = this.dataGrid.Items[i].Cells[0].FindControl("chkSel");
if( ((HtmlInputCheckBox)findObj).Checked ) //在此步调试时,发现对象已
//经获取并转换,但是Checked始终是false.
{
//执行相关代码
... ...
}
}
}
谢谢。
我的系统中有很多类似的页面,其他页面都执行正常,只有这一个页面出现这种情况。
我将几个页面的代码反复对比,没有发现不正常的地方。我怀疑是不是asp.net不稳定导致这种情况呢。
你再仔细查查 页面的 Html