我有一个grid
时间表条目。
列列表是这样的。
S.No Slot Name Monday Tuesday Wednesday Thursday Friday
==== ========= ======= ======= ========= ======== ========
列插槽名称具有已从数据库加载的值。
用户可以在任何时间段(即时间段)下输入任何一天的数据。(用户可以从单击每列内的添加按钮出现的弹出窗口中添加数据)。
如果用户没有输入任何一天,则不应将数据保存到数据库中。我该如何检查?
此页面中的 PS 保存操作首先将数据保存到包含学校、班级、学期、部门等信息的父表中,保存后,将每天的个人详细信息保存到另一个表中。
@Syed,这是我的插入代码。
Dim sFacultyLabelDetail As String = "lbl" & sDay & "Faculty"
Dim lblFacNameDetail As System.Web.UI.WebControls.Label = row.FindControl(sFacultyLabel)
Dim sSubjectLabelDetail As String = "lbl" & sDay & "Subject"
Dim lblSubjectNameDetail As System.Web.UI.WebControls.Label = row.FindControl(sSubjectLabel)
dsGetTimeTableDetailID = (From t1 In dbl.TimeTableDetails Where t1.TimeTableBreakUpID = dsSaveTimeTableBreakUpDetails And t1.Date = stDate Select t1.TimeTableDetailID).FirstOrDefault.ToString
If (dsGetTimeTableDetailID = 0 And (Trim(lblSubjectNameDetail.Text) <> "" Or Trim(lblFacNameDetail.Text) <> "" Or Trim(lblIsExternal.Text) <> "")) Then
dsSaveTimeTableDetailsForView = dbl.usp_InsertTimeTableDetailsForViewTimeTable(0, dsSaveTimeTableBreakUpDetails, Val(lblFacID.Text), Trim(lblFacNameDetail.Text), Val(lblSubjectID.Text), Trim(lblSubjectNameDetail.Text), stDate.Date, Trim(lblIsExternal.Text), sDayName, "Y", sUserName, DateTime.Now).ReturnValue
ElseIf (dsGetTimeTableDetailID <> 0) And (Trim(lblSubjectNameDetail.Text) = "" And (Trim(lblFacNameDetail.Text) = "" And Trim(lblIsExternal.Text) = "")) Then
dsSaveTimeTableDetailsForView = dbl.usp_UpdateTimeTableDetailsForViewTimeTable(dsGetTimeTableDetailID, dsSaveTimeTableBreakUpDetails, Val(lblFacID.Text), Trim(lblFacNameDetail.Text), Val(lblSubjectID.Text), Trim(lblSubjectNameDetail.Text), stDate.Date, Trim(lblIsExternal.Text), sDayName, "N", sUserName, DateTime.Now).ReturnValue
ElseIf (dsGetTimeTableDetailID <> 0 And (Trim(lblSubjectNameDetail.Text) <> "" Or Trim(lblFacNameDetail.Text) <> "" Or Trim(lblIsExternal.Text) <> "")) Then
dsSaveTimeTableDetailsForView = dbl.usp_UpdateTimeTableDetailsForViewTimeTable(dsGetTimeTableDetailID, dsSaveTimeTableBreakUpDetails, Val(lblFacID.Text), Trim(lblFacNameDetail.Text), Val(lblSubjectID.Text), Trim(lblSubjectNameDetail.Text), stDate.Date, Trim(lblIsExternal.Text), sDayName, "Y", sUserName, DateTime.Now).ReturnValue
End If
这里sDay是网格中的标题名称(星期一/星期二...)