Hani Honey
Hani Honey

Reputation: 2131

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 bit field).

Upvotes: 0

Views: 1028

Answers (1)

FiveTools
FiveTools

Reputation: 6030

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.

Upvotes: 1

Related Questions