If e.Cancel = False Then If checkbox.Checked = False Then e.Cancel = True label1.Visible = True label1.Text = "select a prod" Else label1.Visible = False
Protected Sub LitFormView_ItemInserting(sender As Object, e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles LitFormView.ItemInserting Dim checkbox As CheckBox = CType(GridView1.FindControl("Checkbox1"), CheckBox) Dim lit As DropDownList = CType(LitFormView.FindControl("DropDownList1"), DropDownList) Dim label1 As Label = CType(LitFormView.FindControl("Label1"), Label) If lit.SelectedValue = "" Then e.Cancel = True label1.Visible = True label1.Text = "select a lit" Else label1.Visible = False 'below is where i get the error If e.Cancel = False Then If checkbox.Checked = False Then e.Cancel = True label1.Visible = True label1.Text = "select a prod" Else label1.Visible = False 'above is where i get the error If e.Cancel = False Then Label4.Text = "" Label5.Text = "" For Each gvr As GridViewRow In GridView1.Rows If gvr.RowType = DataControlRowType.DataRow Then Dim cb As CheckBox = DirectCast(gvr.FindControl("CheckBox1"), CheckBox) Dim literature As DropDownList = CType(LitFormView.FindControl("DropDownList1"), DropDownList) If cb.Checked = True Then Label2.Text = literature.SelectedItem.Text Label3.Text = literature.SelectedValue Label4.Text = Label4.Text + gvr.Cells(1).Text Label5.Text = Label5.Text + gvr.Cells(2).Text End If End If Next Label4.Text = (Label4.Text).Substring(0) Label5.Text = (Label5.Text).Substring(0) End If End If End If End If end sub
If e.Cancel = False Then If checkbox <> Nothing And Not checkbox.Checked Then e.Cancel = True label1.Visible = True label1.Text = "select a prod" End If End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)