我在此网格中创建了一个多视图,一个特定用户只添加了评论。其他用户未被编辑。如果我在此网格模板中采用此模板,则会将文本框用于撰写注释。现在我想如何在这个网格中启用文本框。
我写了计算日期,但它没有工作如何解决这个问题
EP_LeaveManagementRow urnewleave = new EP_LeaveManagementRow();
urnewleave.LeaveAppliedFromDate = Convert.ToDateTime(txtFromDate.Text.Trim());
urnewleave.LeaveAppliedToDate = Convert.ToDateTime(txtToDate.Text.Trim());
if (urnewleave.LeaveAppliedToDate > urnewleave.LeaveAppliedFromDate)
{
//int Days = urnewleave.LeaveAppliedToDate.Subtract(urnewleave.LeaveAppliedToDate
TimeSpan NoOfDays = urnewleave.LeaveAppliedToDate - urnewleave.LeaveAppliedFromDate;
lblNoOfDays.Text = NoOfDays.ToString();
{
// User Details
EP_UserDetailsRow urnewdet = new EP_UserDetailsRow();
urnewdet.FirstName = txtEmpName.Text;
urnewdet.EmpID = txtEmpID.Text;
//Manager Details
EP_UserRow usnewdet = new EP_UserRow();
//usnewdet.MangerUserID= int.Parse(ddlMangaer.SelectedItem.Value);
// Apply leave Details
urnewleave.LeaveType = Convert.ToInt32(ddlLeaveType.SelectedValue.ToString());
urnewleave.LeaveAppliedFromDate = Convert.ToDateTime(txtFromDate.Text.Trim());
urnewleave.LeaveAppliedToDate = Convert.ToDateTime(txtToDate.Text.Trim());
//lblNoOfDays.Text = ""+((urnewleave.LeaveAppliedFromDate > urnewleave.LeaveAppliedToDate)) ?(urnewleave.LeaveAppliedFromDate - urnewleave.LeaveAppliedToDate).TotalDays :(urnewleave.LeaveAppliedToDate - urnewleave.LeaveAppliedFromDate).TotalDays);
urnewleave.LeaveReson = txtReason.Text;
urnewleave.UserID = int.Parse(Session["UserID"].ToString());
urnewleave.CreatedBy = logUser.UserID;
urnewleave.CreatedDate = DateTime.Now;
urnewleave.ModifiedBy = logUser.UserID;
urnewleave.ModifiedDate = DateTime.Now;
urnewleave.LeaveStatus = Convert.ToInt32(ddlStatus.SelectedValue.ToString());
db.EP_LeaveManagementCollection.Insert(urnewleave);
BindLeaveManagementDetails();
mvLeaveManagement.SetActiveView(vwLeavesDetails);
答案 0 :(得分:0)
你可以这样做:
myDataGridView1.Enabled = true;
这将使您的所有文本框都允许编辑。