CheckBox的状态改变了,checked属性值却没有改变这是为什么?谁能帮帮我呢? 对不起更正一下,在datalist的模板列中放的是一个HtmlInputCheckBox。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你要对CheckBox进行转换,如果是Checked,那么就把该CheckBox对应的数据1或0保存到数据库中,除非你使用的是true,false,否则自己要转换一下的。HtmlInputCheckBox可以让他运行在服务器端。 问题是,我在程序中设断点,当走到判断HtmlInputCheckBox控件的checked属性时,它总是跳到true部分去执行。可明明是false呀。 这一段是datalist的itemdatabund事件中为chk2写的一段客户端代码:(控制其它控件的可操作性)chk2.Attributes("onclick") = "javascript: " & _ " if (" & chk2.ClientID & ".checked) " & _ " { " & Bgtime.ClientID & ".disabled = false;" & _ Edtime.ClientID & ".disabled = false;" & _ Vbtime.ClientID & ".enabled = true; " & _ Vetime.ClientID & ".enabled = true; " & _ " } " & _ " else " & _ " { " & Bgtime.ClientID & ".disabled = true;" & _ Edtime.ClientID & ".disabled = true;" & _ Vbtime.ClientID & ".enabled = false; " & _ Vetime.ClientID & ".enabled = false; " & _ " } "这一段是向数据库中添数据的,要判断chk2的状态:Dim chk2 As HtmlInputCheckBox = CType(DL.Items(index).FindControl("checkbox" & dlnum & "_2"), HtmlInputCheckBox) If Not chk2 Is Nothing Then 'Response.Write(bid & " " & chk2.Checked.ToString() & " " & chk2.Checked & "<br>") If chk2.Checked = False Then oRow.Item("TimeLimit") = 0 oRow.Item("TimeBegin") = DateTime.Now oRow.Item("TimeEnd") = DateTime.Now Else oRow.Item("TimeLimit") = 1 Dim txt4 As TextBox = CType(DL.Items(index).FindControl("Textbox" & dlnum & "_2"), TextBox) If Not txt4 Is Nothing And txt4.Text <> "" Then oRow.Item("TimeBegin") = txt4.Text Else oRow.Item("TimeBegin") = DateTime.Now End If Dim txt5 As TextBox = CType(DL.Items(index).FindControl("Textbox" & dlnum & "_3"), TextBox) If Not txt5 Is Nothing And txt5.Text <> "" Then oRow.Item("TimeEnd") = txt5.Text Else oRow.Item("TimeEnd") = DateTime.Now End If End If End If asp.net 调用C++ dll 问题 该模块应包含一个程序集清单 异常来自 HRESULT:0X80131018 文本编辑器FCKeditor ,要是插入数据库,图片怎么处理。或者调用呀。 datalist中的linkbutton事件触发问题 水晶报报表问题 如何给datalist在绑定的数据源之后再加一项,见内 TreeView 怎么实现点击展开点的时候不提交啊。。这样好闪 radiaobuttonlist的显示问题 有关datagrid 行列获得的问题 为什么装不到呀、 怎样动态的设置DropDownList组件的默然值,即静态的seleced的值!11 小问题
chk2.Attributes("onclick") = "javascript: " & _
" if (" & chk2.ClientID & ".checked) " & _
" { " & Bgtime.ClientID & ".disabled = false;" & _
Edtime.ClientID & ".disabled = false;" & _
Vbtime.ClientID & ".enabled = true; " & _
Vetime.ClientID & ".enabled = true; " & _
" } " & _
" else " & _
" { " & Bgtime.ClientID & ".disabled = true;" & _
Edtime.ClientID & ".disabled = true;" & _
Vbtime.ClientID & ".enabled = false; " & _
Vetime.ClientID & ".enabled = false; " & _
" } "
这一段是向数据库中添数据的,要判断chk2的状态:
Dim chk2 As HtmlInputCheckBox = CType(DL.Items(index).FindControl("checkbox" & dlnum & "_2"), HtmlInputCheckBox)
If Not chk2 Is Nothing Then
'Response.Write(bid & " " & chk2.Checked.ToString() & " " & chk2.Checked & "<br>")
If chk2.Checked = False Then
oRow.Item("TimeLimit") = 0
oRow.Item("TimeBegin") = DateTime.Now
oRow.Item("TimeEnd") = DateTime.Now
Else
oRow.Item("TimeLimit") = 1
Dim txt4 As TextBox = CType(DL.Items(index).FindControl("Textbox" & dlnum & "_2"), TextBox)
If Not txt4 Is Nothing And txt4.Text <> "" Then
oRow.Item("TimeBegin") = txt4.Text
Else
oRow.Item("TimeBegin") = DateTime.Now
End If
Dim txt5 As TextBox = CType(DL.Items(index).FindControl("Textbox" & dlnum & "_3"), TextBox)
If Not txt5 Is Nothing And txt5.Text <> "" Then
oRow.Item("TimeEnd") = txt5.Text
Else
oRow.Item("TimeEnd") = DateTime.Now
End If
End If
End If