Set Checked property in asp using Eval
I have a statement that looks like this:
<asp:CheckBox ID="CheckBoxProcess" Checked='<%#Eval("processedField") %>' OnCheckedChanged="CheckBoxProcess_CheckedChanged" runat="server" Enabled="true" />
I've been having this problem for a while, and I KNOW it must be something VERY simple...but in my code, where it says processedField
what EXACTLY goes there? I want it to reference a column from my database, but I don't know how to make that available to this particular part of code.
A second question, does this bind the CheckBox
column to my field in my database? I want something to be written to the database when this checkbox is checked. For example, when the checkbox is checked, make the value in the processedField
become a 1
instead of a 0
(it is a 开发者_StackOverflow社区bit field).
set AutoPostBack = "true", the "CheckBoxProcess_CheckedChanged" method then would contain the code that writes the changed value to your database. However, I'm not 100% confident I understand your question.
精彩评论