我想知道datagril里的复选框是否选中,下面的代码在1.1里有效,
2.0里应该怎么改进才能获得网页里是否选中呢?
foreach(DataGridItem item in ttt.Items)
{
CheckBox move = (CheckBox)item.FindControl("votecheck");
if (move != null)
{
if (move.Checked == 3 > 2)
{
qq.updatevote(Convert.ToInt32(ttt.DataKeys[item.ItemIndex].ToString()));
lba.Text = "投票成功,谢谢!!";
}
}
}
2.0里应该怎么改进才能获得网页里是否选中呢?
foreach(DataGridItem item in ttt.Items)
{
CheckBox move = (CheckBox)item.FindControl("votecheck");
if (move != null)
{
if (move.Checked == 3 > 2)
{
qq.updatevote(Convert.ToInt32(ttt.DataKeys[item.ItemIndex].ToString()));
lba.Text = "投票成功,谢谢!!";
}
}
}
解决方案 »
- 请大侠 帮助解释一下 这两个方法的解释说明 没看明白
- 关于权限设计的问题???
- 小弟刚学。net,怎样才使每个登入网站的用户都赋予一个ID!(如何使用session保证ID值唯一)
- 请用asp.net开发过b/s程序的朋友进来指点一下
- 如何获取RadioButtonList被选中的Item的Text?
- 简单问题,即刻揭帖!!!
- 无法浏览Web应用程序的页面, why?
- html控件的简单问题
- 求教repeater 导出EXCEL,导出后前十五行为空白如何去除
- 在TEXTAREA写入的内容,读出的时不能自动换行,怎么办,急!!
- 请问original_????是什么意思
- 请问如何在按一个按钮时同时实现点击另外一个hyperlink的功能
gridview:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
CheckBox move = (CheckBox)e.Row.FindControl("votecheck");
}
string _BO_NO = year + month + day + Number;
foreach (GridViewRow dr in GridView1.Rows)
{
chk = (CheckBox)dr.FindControl("checkboxname");
if (chk.Checked)
{
int QTY = Convert.ToInt32(dr.Cells[4].ToString());
string PRD_NO = dr.Cells[2].ToString();
string PRD_NAME = dr.Cells[3].ToString();
string BO_NO = _BO_NO;
string insertSQL = "insert into OP_Prdt_Borrow(BO_NO,Prdt_NO) vaules('" + BO_NO + "','" + PRD_NO + "')";
link.ExcuteDataBase(insertSQL); }
在 if (chk.Checked) 这里过不去!
$exception {"未将对象引用设置到对象的实例。"} System.Exception {System.NullReferenceException}
这要怎么处理啊!
continue;就行了!
System.Web.UI.WebControls.CheckBox chk;
foreach (GridViewRow dr in GridView1.Rows)
{
chk = (CheckBox)dr.FindControl("checkboxname");
if (chk == null)
continue;
else
{
if (chk.Checked)
}
这样可以用,楼主!
是可以用了
问题已解决
愿来连数用dataset才行
神奇