protected void dvSystemData_ItemCommand(object sender, DetailsViewCommandEventArgs e) { if (e.CommandName.Equals("Update")) { DetailsViewRow _EdittedRow = dvSystemData.Rows[dvSystemData.DataItemIndex]; CheckBox _DoReoccuringOrdersCheckBox = (CheckBox)_EdittedRow.FindControl("DoReoccuringOrdersCheckBox"); TextBox _LastReoccurringDateTextBox = (TextBox)_EdittedRow.FindControl("LastReoccurringDateTextBox"); TextBox _DateLastPrepDateCalcdTextBox = (TextBox)_EdittedRow.FindControl("DateLastPrepDateCalcdTextBox"); TextBox _MinReminderDateTextBox = (TextBox)_EdittedRow.FindControl("MinReminderDateTextBox"); TextBox _GroupItemTypeIDTextBox = (TextBox)_EdittedRow.FindControl("GroupItemTypeIDTextBox"); Label _IDLabel = (Label)_EdittedRow.FindControl("IDLabel"); control.SysDataTbl _SysData = new control.SysDataTbl(); _SysData.ID = Convert.ToInt32(_IDLabel.Text); _SysData.DoReoccuringOrders = _DoReoccuringOrdersCheckBox.Checked; _SysData.LastReoccurringDate = Convert.ToDateTime(_LastReoccurringDateTextBox.Text); _SysData.DateLastPrepDateCalcd = Convert.ToDateTime(_DateLastPrepDateCalcdTextBox.Text); _SysData.MinReminderDate = Convert.ToDateTime(_MinReminderDateTextBox.Text); _SysData.GroupItemTypeID = Convert.ToInt32(_GroupItemTypeIDTextBox.Text); _SysData.Update(_SysData); dvSystemData.DataBind(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { DetailsViewRow dr = DetailsView1.Rows[0]; HiddenField hf = dr.FindControl("HiddenField1") as HiddenField; DataTable dt = con.getOwnerDetail(hf.Value, Request.QueryString["Id"].ToString()); (DetailsView1.Rows[0].FindControl("Label11") as Label).Text = "Name : " + dt.Rows[0][1].ToString(); (DetailsView1.Rows[0].FindControl("Label12") as Label).Text = "Phone Number : " + dt.Rows[0][2].ToString(); (DetailsView1.Rows[0].FindControl("Label13") as Label).Text = "Email ID : " + dt.Rows[0][3].ToString(); int propertyCount = con.getOwnerPropertyCount(dt.Rows[0][0].ToString()); if (propertyCount > 1) { (DetailsView1.Rows[0].FindControl("Label11") as Label).ForeColor = System.Drawing.Color.Red; (DetailsView1.Rows[0].FindControl("Label12") as Label).ForeColor = System.Drawing.Color.Red; (DetailsView1.Rows[0].FindControl("Label13") as Label).ForeColor = System.Drawing.Color.Red; } }