Checked='<%# Eval("PreAcqClaim") ==DBNull.Value?false:true %>' MARKUP
------------------CODE BEHIND--------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Claim : System.Web.UI.Page
{
CheckBox OurFaultCheckBox = new CheckBox();
CheckBox PicturesCheckBox = new CheckBox();
CheckBox ReportedInsCheckBox = new CheckBox();
CheckBox ReportLateCheckBox = new CheckBox();
CheckBox AssistRepairCheckBox = new CheckBox();
CheckBox LitigationCheckBox = new CheckBox();
CheckBox PreAcqClaimCheckBox = new CheckBox();
DetailsDataTableAdapters.tblClaimsTableAdapter _adapter = new DetailsDataTableAdapters.tblClaimsTableAdapter();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lvDetails.DataSource = _adapter.GetDataByPK_Claim_ID(Convert.ToInt32(Request.QueryString["PK_Claim_ID"]));
lvDetails.DataBind();
}
}
protected void objDetails_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
}
protected void lvDetails_ItemDataBound(object sender, ListViewItemEventArgs e)
{
//CheckBox OurFaultCheckBox = (CheckBox)lvDetails.FindControl("OurFaultCheckBox");
//OurFaultCheckBox.Checked = true;
//OurFaultCheckBox = (CheckBox)e.Item.FindControl("OurFaultCheckBox");
//PicturesCheckBox = (CheckBox)e.Item.FindControl("PicturesCheckBox");
//ReportedInsCheckBox = (CheckBox)e.Item.FindControl("ReportedInsCheckBox");
//ReportLateCheckBox = (CheckBox)e.Item.FindControl("ReportLateCheckBox");
//AssistRepairCheckBox = (CheckBox)e.Item.FindControl("AssistRepairCheckBox");
//LitigationCheckBox = (CheckBox)e.Item.FindControl("LitigationCheckBox");
//PreAcqClaimCheckBox = (CheckBox)e.Item.FindControl("PreAcqClaimCheckBox");
}
protected void objDetails_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
{
CheckBox OurFaultCheckBox = (CheckBox)lvDetails.FindControl("OurFaultCheckBox");
e.InputParameters.Add("OurFaultCheckBox", OurFaultCheckBox.Checked);
}
protected void objDetails_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters.Add("OurFault", OurFaultCheckBox.Checked);
e.InputParameters.Add("Pictures", PicturesCheckBox.Checked);
e.InputParameters.Add("ReportedIns", ReportedInsCheckBox.Checked);
e.InputParameters.Add("ReportLate", ReportLateCheckBox.Checked);
e.InputParameters.Add("AssistRepair", AssistRepairCheckBox.Checked);
e.InputParameters.Add("Litigation", LitigationCheckBox.Checked);
e.InputParameters.Add("PreAcqClaim", PreAcqClaimCheckBox.Checked);
}
protected void lvDetails_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
DetailsDataTableAdapters.tblClaimsTableAdapter _adapter = new DetailsDataTableAdapters.tblClaimsTableAdapter();
OurFaultCheckBox = (CheckBox)lvDetails.EditItem.FindControl("OurFaultCheckBox");
PicturesCheckBox = (CheckBox)lvDetails.EditItem.FindControl("PicturesCheckBox");
ReportedInsCheckBox = (CheckBox)lvDetails.EditItem.FindControl("ReportedInsCheckBox");
ReportLateCheckBox = (CheckBox)lvDetails.EditItem.FindControl("ReportLateCheckBox");
AssistRepairCheckBox = (CheckBox)lvDetails.EditItem.FindControl("AssistRepairCheckBox");
LitigationCheckBox = (CheckBox)lvDetails.EditItem.FindControl("LitigationCheckBox");
PreAcqClaimCheckBox = (CheckBox)lvDetails.EditItem.FindControl("PreAcqClaimCheckBox");
try
{
_adapter.Update("eventNum", "jobNum","test", "1", DateTime.Now, "", "", "",
"", "", "", DateTime.Now, "", "", "", "54143", "", "", "",
OurFaultCheckBox.Checked, PicturesCheckBox.Checked,
ReportedInsCheckBox.Checked, ReportLateCheckBox.Checked,
AssistRepairCheckBox.Checked, LitigationCheckBox.Checked,
PreAcqClaimCheckBox.Checked,
Convert.ToInt32(Request.QueryString["PK_Claim_ID"]));
}
catch (Exception ex)
{
}
lvDetails.EditIndex = -1;
}
protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
}
protected void lvDetails_ItemEditing(object sender, ListViewEditEventArgs e)
{
lvDetails.EditIndex = e.NewEditIndex;
}
}