Iam getting error at this code in itemdatabound.Previously it has worked fine but it is not working now.(Error is Object is not referenced)
Dim solutionId As Integer = CType(CType(row.FindControl("LblSolutionResultId"), Label).Text, Integer)
<telerik:RadGrid ID="rgResultRanges" runat="server" AllowSorting="True" AutoGenerateColumns="False" Width="98%" BorderWidth="3px"
GridLines="None" OnNeedDataSource="rgResultRanges_NeedDataSource" OnUpdateCommand="rgResultRanges_Update"
OnInsertCommand="rgResultRanges_Insert" OnDeleteCommand="rgResultRanges_Delete"
OnItemDataBound="rgResultRanges_ItemDataBound">
<MasterTableView DataKeyNames="SolutionResultRangeID" CommandItemDisplay="Top">
<CommandItemTemplate>
<asp:Button ID="BtnAdd" runat="server" Text="Add Result Combination For Selected Solution Type"
CommandName="InitInsert" />
</CommandItemTemplate>
<Columns>
<telerik:GridButtonColumn CommandName="Edit" ButtonType="ImageButton" ImageUrl="~/Images/pencil.png"
ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center">
</telerik:GridButtonColumn>
<telerik:GridTemplateColumn UniqueName="Result1" DataField="Result1" HeaderText="Result #1"
SortExpression="Result1">
<ItemTemplate>
<asp:Label ID="LblResult1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlResult1" runat="server" />
<asp:RequiredFieldValidator ID="ResultValidator" runat="server" Display="Dynamic"
ControlToValidate="ddlResult1" ErrorMessage="Result Feild is Required" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Operator1" DataField="Operator1" HeaderText="Op">
<ItemTemplate>
<asp:Label ID="LblOperator1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlOperator1" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text=">" Value=">" />
<asp:ListItem Text="<" Value="<" />
<asp:ListItem Text="=" Value="=" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="OperatorValidator" runat="server" Display="Dynamic"
ControlToValidate="ddlOperator1" ErrorMessage="Operator is Required" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Value1" DataField="Value1" HeaderText="Val">
<ItemTemplate>
<asp:Label ID="LblValue1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtValue1" runat="server" />
<asp:RequiredFieldValidator ID="ValueValidator" runat="server" Display="Dynamic"
ControlToValidate="TxtValue1" ErrorMessage="Value is Required" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Join1" DataField="Join1" HeaderText="Join #1">
<ItemTemplate>
<asp:Label ID="LblJoin1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlJoin1" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text="AND" Value="AND" />
<asp:ListItem Text="OR" Value="OR" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="JoinValidator" runat="server" Display="Dynamic" ControlToValidate="ddlJoin1"
ErrorMessage="Join is Required" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Result2" DataField="Result2" HeaderText="Result #2"
SortExpression="Result2">
<ItemTemplate>
<asp:Label ID="LblResult2" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlResult2" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Operator2" DataField="Operator2" HeaderText="Op">
<ItemTemplate>
<asp:Label ID="LblOperator2" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlOperator2" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text=">" Value=">" />
<asp:ListItem Text="<" Value="<" />
<asp:ListItem Text="=" Value="=" />
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Value2" DataField="Value2" HeaderText="Val">
<ItemTemplate>
<asp:Label ID="LblValue2" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtValue2" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Join2" DataField="Join1" HeaderText="Join #2">
<ItemTemplate>
<asp:Label ID="LblJoin2" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlJoin2" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text="AND" Value="AND" />
<asp:ListItem Text="OR" Value="OR" />
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Result3" DataField="Result3" HeaderText="Result #3"
SortExpression="Result3">
<ItemTemplate>
<asp:Label ID="LblResult3" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlResult3" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Operator3" DataField="Operator3" HeaderText="Op">
<ItemTemplate>
<asp:Label ID="LblOperator3" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlOperator3" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text=">" Value=">" />
<asp:ListItem Text="<" Value="<" />
<asp:ListItem Text="=" Value="=" />
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Value3" DataField="Value3" HeaderText="Val">
<ItemTemplate>
<asp:Label ID="LblValue3" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtValue3" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Join3" DataField="Join3" HeaderText="Join #3">
<ItemTemplate>
<asp:Label ID="LblJoin3" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlJoin3" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text="AND" Value="AND" />
<asp:ListItem Text="OR" Value="OR" />
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Result4" DataField="Result4" HeaderText="Result #4"
SortExpression="Result4">
<ItemTemplate>
<asp:Label ID="LblResult4" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlResult4" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Operator4" DataField="Operator4" HeaderText="Op">
<ItemTemplate>
<asp:Label ID="LblOperator4" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlOperator4" runat="server">
<asp:ListItem Text="" Value="" />
<asp:ListItem Text=">" Value=">" />
<asp:ListItem Text="<" Value="<" />
<asp:ListItem Text="=" Value="=" />
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Value4" DataField="Value4" HeaderText="Val">
<ItemTemplate>
<asp:Label ID="LblValue4" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtValue4" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="FlagText" HeaderText="Flag Text">
<ItemTemplate>
<asp:Label ID="LblFlagText" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Flag Text" Visible="false" >
<ItemTemplate>
<asp:Label ID="LblSolutionResultId" runat="server" Text='<%# Eval("SolutionResultId") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Flag Text" Visible="false" DataField="SolutionResultId">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" UniqueName="BtnDelete" ItemStyle-Width="20px"
ConfirmText="Are you sure you wish to delete this result range?" ButtonType="ImageButton"
ItemStyle-HorizontalAlign="Center" ImageUrl="~/Images/delete.png">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<EditColumn InsertText="Add" CancelText="Cancel">
</EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
Imports Telerik.Web.UI
Imports Common
Partial Public Class MaintainQualityControlResults
Inherits BasePage
Private _SolutionResults As New Dictionary(Of String, String)
Dim solutionResultId As Integer
Protected Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'populate listbox
lstSolutionTypeGroup.DataSource = BusinessLayer.SolutionType.GetSolutionTypeGroupList
lstSolutionTypeGroup.DataValueField = "SolutionTypeGroupID"
lstSolutionTypeGroup.DataTextField = "SolutionTypeGroupText"
lstSolutionTypeGroup.DataBind()
End If
End Sub
Protected Sub rgResultRanges_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)
'check if a Solution Type Group is selected
If lstSolutionTypeGroup.SelectedIndex > -1 Then
Dim ResultRangeList As List(Of DataLayer.uspSolution_GetAvailableSolutionResultsResult) = _
BusinessLayer.SolutionQualityControl.GetAvailableSolutionResultRanges(lstSolutionTypeGroup.SelectedValue)
rgResultRanges.DataSource = ResultRangeList
'if there are records, than populate dropdown list data
'If ResultRangeList.Count > 0 Then
_SolutionResults = BusinessLayer.SolutionQualityControl.GetAllSolutionResults()
'End If
End If
End Sub
Protected Sub rgResultRanges_Update(ByVal sender As Object, ByVal e As GridCommandEventArgs)
'check if there is a Solution Type Group selected
If lstSolutionTypeGroup.SelectedIndex > -1 Then
'check if passed grid validation
If gridValidate(CType(e.Item, GridEditableItem)) Then
Try
'pull values from grid row
Dim editItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim ResultRangeID As Integer = e.Item.OwnerTableView.DataKeyValues(editItem.ItemIndex)("SolutionResultRangeID").ToString()
Dim Result1 As String = CType(e.Item.FindControl("ddlResult1"), DropDownList).SelectedValue
Dim Operator1 As String = CType(e.Item.FindControl("ddlOperator1"), DropDownList).SelectedValue
'check if there is a value
Dim txtV1 As TextBox = CType(e.Item.FindControl("TxtValue1"), TextBox)
Dim Value1 As Double
If txtV1.Text.Length > 0 Then
Value1 = CType(txtV1.Text, Double)
End If
Dim Join1 As String = CType(e.Item.FindControl("ddlJoin1"), DropDownList).SelectedValue
If Result1 <> "" Then
solutionResultId = 1
BusinessLayer.SolutionQualityControl.UpdateResultRange(ResultRangeID, lstSolutionTypeGroup.SelectedValue, solutionResultId, Convert.ToInt32(Result1.ToString()), Operator1, Value1, Join1, False, User.Identity.Name)
End If
Dim Result2 As String = CType(e.Item.FindControl("ddlResult2"), DropDownList).SelectedValue
Dim Operator2 As String = CType(e.Item.FindControl("ddlOperator2"), DropDownList).SelectedValue
'check if there is a value
Dim txtV2 As TextBox = CType(e.Item.FindControl("TxtValue2"), TextBox)
Dim Value2 As Double
If txtV2.Text.Length > 0 Then
Value2 = CType(txtV2.Text, Double)
End If
Dim Join2 As String = CType(e.Item.FindControl("ddlJoin2"), DropDownList).SelectedValue
If Result2 <> "" Then
solutionResultId = 2
BusinessLayer.SolutionQualityControl.UpdateResultRange(ResultRangeID, lstSolutionTypeGroup.SelectedValue, solutionResultId, Convert.ToInt32(Result2.ToString()), Operator2, Value2, Join2, False, User.Identity.Name)
End If
Dim Result3 As String = CType(e.Item.FindControl("ddlResult3"), DropDownList).SelectedValue
Dim Operator3 As String = CType(e.Item.FindControl("ddlOperator3"), DropDownList).SelectedValue
'check if there is a value
Dim txtV3 As TextBox = CType(e.Item.FindControl("TxtValue3"), TextBox)
Dim Value3 As Double
If txtV3.Text.Length > 0 Then
Value3 = CType(txtV3.Text, Double)
End If
Dim Join3 As String = CType(e.Item.FindControl("ddlJoin3"), DropDownList).SelectedValue
If Result3 <> "" Then
solutionResultId = 3
BusinessLayer.SolutionQualityControl.UpdateResultRange(ResultRangeID, lstSolutionTypeGroup.SelectedValue, solutionResultId, Convert.ToInt32(Result3.ToString()), Operator3, Value3, Join3, False, User.Identity.Name)
End If
Dim Result4 As String = CType(e.Item.FindControl("ddlResult4"), DropDownList).SelectedValue
Dim Operator4 As String = CType(e.Item.FindControl("ddlOperator4"), DropDownList).SelectedValue
'check if there is a value
Dim txtV4 As TextBox = CType(e.Item.FindControl("TxtValue4"), TextBox)
Dim Value4 As Double
If txtV4.Text.Length > 0 Then
Value4 = CType(txtV4.Text, Double)
End If
'save changes
If Result4 <> "" Then
solutionResultId = 4
BusinessLayer.SolutionQualityControl.UpdateResultRange(ResultRangeID, lstSolutionTypeGroup.SelectedValue, solutionResultId, Convert.ToInt32(Result4.ToString()), Operator4, Value4, "", False, User.Identity.Name)
End If
Catch ex As Exception
Common.ErrorHandling.ProcessError(ex, "An error occurred while attempting to update a result range.", , , )
End Try
Else
e.Canceled = True
End If
Else
DisplayAlert("Please select a solution type before adding a result range.")
End If
End Sub
Protected Sub rgResultRanges_Delete(ByVal sender As Object, ByVal e As GridCommandEventArgs)
Try
Dim editItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim ResultRangeID As Integer = e.Item.OwnerTableView.DataKeyValues(editItem.ItemIndex)("SolutionResultRangeID").ToString()
BusinessLayer.SolutionQualityControl.UpdateResultRange(ResultRangeID, 0, 0, 0, String.Empty, 0, String.Empty, True, _
User.Identity.Name)
Catch ex As Exception
Common.ErrorHandling.ProcessError(ex, "An error occurred while attempting to update a result range.", , , )
End Try
End Sub
Protected Sub rgResultRanges_Insert(ByVal sender As Object, ByVal e As GridCommandEventArgs)
'check if there is a Solution Type Group selected
If lstSolutionTypeGroup.SelectedIndex > -1 Then
'check if passed grid validation
If gridValidate(CType(e.Item, GridEditableItem)) Then
Try
' Dim ResultRangeList As List(Of DataLayer.uspSolution_GetMaxSolutionrangeIdResult) = BusinessLayer.SolutionQualityControl.GetMaxRangeId()
Dim rangeId As Integer = BusinessLayer.SolutionQualityControl.GeMaxRangeId()
Dim editItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim Result1 As String = CType(e.Item.FindControl("ddlResult1"), DropDownList).SelectedValue
Dim Operator1 As String = CType(e.Item.FindControl("ddlOperator1"), DropDownList).SelectedValue
'check if there is a value
Dim txtV1 As TextBox = CType(e.Item.FindControl("TxtValue1"), TextBox)
Dim Value1 As Double
If txtV1.Text.Length > 0 Then
Value1 = CType(txtV1.Text, Double)
End If
Dim Join1 As String = CType(e.Item.FindControl("ddlJoin1"), DropDownList).SelectedValue
If Result1 <> "" Then
solutionResultId = 1
BusinessLayer.SolutionQualityControl.AddResultRange(lstSolutionTypeGroup.SelectedValue, rangeId, solutionResultId, Convert.ToInt32(Result1.ToString()), Operator1, Value1, Join1, False, User.Identity.Name)
End If
Dim Result2 As String = CType(e.Item.FindControl("ddlResult2"), DropDownList).SelectedValue
Dim Operator2 As String = CType(e.Item.FindControl("ddlOperator2"), DropDownList).SelectedValue
'check if there is a value
Dim txtV2 As TextBox = CType(e.Item.FindControl("TxtValue2"), TextBox)
Dim Value2 As Double
If txtV2.Text.Length > 0 Then
Value2 = CType(txtV2.Text, Double)
End If
Dim Join2 As String = CType(e.Item.FindControl("ddlJoin2"), DropDownList).SelectedValue
If Result2 <> "" Then
solutionResultId = 2
BusinessLayer.SolutionQualityControl.AddResultRange(lstSolutionTypeGroup.SelectedValue, rangeId, solutionResultId, Convert.ToInt32(Result2.ToString()), Operator2, Value2, Join2, False, User.Identity.Name)
End If
Dim Result3 As String = CType(e.Item.FindControl("ddlResult3"), DropDownList).SelectedValue
Dim Operator3 As String = CType(e.Item.FindControl("ddlOperator3"), DropDownList).SelectedValue
'check if there is a value
Dim txtV3 As TextBox = CType(e.Item.FindControl("TxtValue3"), TextBox)
Dim Value3 As Double
If txtV3.Text.Length > 0 Then
Value3 = CType(txtV3.Text, Double)
End If
Dim Join3 As String = CType(e.Item.FindControl("ddlJoin3"), DropDownList).SelectedValue
If Result3 <> "" Then
solutionResultId = 3
BusinessLayer.SolutionQualityControl.AddResultRange(lstSolutionTypeGroup.SelectedValue, rangeId, solutionResultId, Convert.ToInt32(Result3.ToString()), Operator3, Value3, Join3, False, User.Identity.Name)
End If
Dim Result4 As String = CType(e.Item.FindControl("ddlResult4"), DropDownList).SelectedValue
Dim Operator4 As String = CType(e.Item.FindControl("ddlOperator4"), DropDownList).SelectedValue
'check if there is a value
Dim txtV4 As TextBox = CType(e.Item.FindControl("TxtValue4"), TextBox)
Dim Value4 As Double
If txtV4.Text.Length > 0 Then
Value4 = CType(txtV4.Text, Double)
End If
If Result4 <> "" Then
solutionResultId = 4
BusinessLayer.SolutionQualityControl.AddResultRange(lstSolutionTypeGroup.SelectedValue, rangeId, solutionResultId, Convert.ToInt32(Result4.ToString()), Operator4, Value4, "", False, User.Identity.Name)
End If
'BusinessLayer.SolutionQualityControl.AddResultRange(lstSolutionTypeGroup.SelectedValue, Result1, Operator1, Value1, Join1, Result2, Operator2, _
' Value2, Join2, Result3, Operator3, Value3, Join3, Result4, Operator4, Value4, False, _
' User.Identity.Name)
Catch ex As Exception
Common.ErrorHandling.ProcessError(ex, "An error occurred while attempting to add a result range.", , , )
End Try
Else
e.Canceled = True
End If
Else
DisplayAlert("Please select a solution type before adding a result range.")
End If
End Sub
Protected Sub rgResultRanges_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
Dim dropList As DropDownList = Nothing
Dim row As GridItem = e.Item
Dim rowLabel As Label = Nothing
Dim R1 As String
Dim O1 As String
Dim V1 As String
Dim J1 As String
Dim R2 As String
Dim O2 As String
Dim V2 As String
Dim J2 As String
Dim R3 As String
Dim O3 As String
Dim V3 As String
Dim J3 As String
Dim R4 As String
Dim O4 As String
Dim V4 As String
If e.Item.ItemType = GridItemType.Item Then
'Dim solutionId As String = CType(row.FindControl("LblSolutionResultId"), Label).Text
'Dim solutionId As String = e.Item.Cells(17).Text.ToString().Trim()
Dim solutionId As Integer = CType(CType(row.FindControl("LblSolutionResultId"), Label).Text, Integer)
If solutionId = 1 Then
R1 = CType(row.FindControl("LblResult1"), Label).Text
O1 = CType(row.FindControl("LblOperator1"), Label).Text
V1 = CType(row.FindControl("LblValue1"), Label).Text
J1 = CType(row.FindControl("LblJoin1"), Label).Text
Else
CType(row.FindControl("LblResult1"), Label).Text = ""
CType(row.FindControl("LblOperator1"), Label).Text = ""
CType(row.FindControl("LblValue1"), Label).Text = ""
CType(row.FindControl("LblJoin1"), Label).Text = ""
End If
If solutionId = 2 Then
R2 = CType(row.FindControl("LblResult2"), Label).Text
O2 = CType(row.FindControl("LblOperator2"), Label).Text
V2 = CType(row.FindControl("LblValue2"), Label).Text
J2 = CType(row.FindControl("LblJoin2"), Label).Text
Else
CType(row.FindControl("LblResult2"), Label).Text = ""
CType(row.FindControl("LblOperator2"), Label).Text = ""
CType(row.FindControl("LblValue2"), Label).Text = ""
CType(row.FindControl("LblJoin2"), Label).Text = ""
End If
If solutionId = 3 Then
R3 = CType(row.FindControl("LblResult3"), Label).Text
O3 = CType(row.FindControl("LblOperator3"), Label).Text
V3 = CType(row.FindControl("LblValue3"), Label).Text
J3 = CType(row.FindControl("LblJoin3"), Label).Text
Else
CType(row.FindControl("LblResult3"), Label).Text = ""
CType(row.FindControl("LblOperator3"), Label).Text = ""
CType(row.FindControl("LblValue3"), Label).Text = ""
CType(row.FindControl("LblJoin3"), Label).Text = ""
End If
If solutionId = 4 Then
R4 = CType(row.FindControl("LblResult4"), Label).Text
O4 = CType(row.FindControl("LblOperator4"), Label).Text
V4 = CType(row.FindControl("LblValue4"), Label).Text
Else
CType(row.FindControl("LblResult4"), Label).Text = ""
CType(row.FindControl("LblOperator4"), Label).Text = ""
CType(row.FindControl("LblValue4"), Label).Text = ""
End If
'check if in read-only mode
If e.Item.ItemType = GridItemType.Item Then
rowLabel = row.FindControl("lblFlagText")
'dynamically populate Flag Text
If Not rowLabel Is Nothing Then
Dim FlagText As String = ""
'check if there is a first set of values
If R1.Length > 0 Then
FlagText = R1 + " " + O1 + " " + V1 + " "
'check if there is a second set of values
If J1.Length > 0 Then
FlagText = FlagText + J1 + " " + R2 + " " + O2 + " " + V2 + " "
'check if there is a third set of values
If J2<> "" Then
FlagText = FlagText + J2 + " " + R3 + " " + O3 + " " + V3 + " "
'check if there is a fourth set of values
If J3 <> "" then
FlagText = FlagText + J3 + " " + R4 + " " + O4 + " " + V4 + " "
End If
End If
End If
End If
rowLabel.Text = FlagText
End If
End If
End If
If (e.Item.ItemType = GridItemType.EditFormItem And e.Item.IsInEditMode And (Not e.Item.OwnerTableView.IsItemInserted)) Then
Dim item As GridEditableItem = CType(e.Item, GridEditableItem)
Dim dataitem As DataLayer.uspSolution_GetAvailableSolutionResultsResult = CType(e.Item.DataItem, DataLayer.uspSolution_GetAvailableSolutionResultsResult)
dropList = row.FindControl("ddlResult1")
If Not dropList Is Nothing Then
If dataitem.SolutionResultId = 1 Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, dataitem.Resultid)
If dataitem.Operator <> String.Empty Then
dropList = row.FindControl("ddlOperator1")
dropList.SelectedValue = dataitem.Operator
End If
'check if there is a value
If dataitem.Join1 <> String.Empty Then
dropList = row.FindControl("ddlJoin1")
dropList.SelectedValue = dataitem.Join1
End If
End If
Else
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
'check if there is a value
dropList = row.FindControl("ddlResult2")
If Not dropList Is Nothing Then
If dataitem.SolutionResultId = 2 Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, dataitem.Resultid)
If Not dataitem.Operator Is Nothing Then
If dataitem.Operator <> String.Empty Then
dropList = row.FindControl("ddlOperator2")
dropList.SelectedValue = dataitem.Operator
End If
End If
'check if there is a value
If Not dataitem.Join1 Is Nothing Then
If dataitem.Join1 <> String.Empty Then
dropList = row.FindControl("ddlJoin2")
dropList.SelectedValue = dataitem.Join1
End If
End If
End If
Else
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
'check if there is a value
dropList = row.FindControl("ddlResult3")
If Not dropList Is Nothing Then
If dataitem.SolutionResultId = 3 Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, dataitem.Resultid)
If Not dataitem.Operator Is Nothing Then
If dataitem.Operator <> String.Empty Then
dropList = row.FindControl("ddlOperator3")
dropList.SelectedValue = dataitem.Operator
End If
End If
'check if there is a value
If Not dataitem.Join1 Is Nothing Then
If dataitem.Join1 <> String.Empty Then
dropList = row.FindControl("ddlJoin3")
dropList.SelectedValue = dataitem.Join1
End If
End If
End If
Else
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
'check if there is a value
dropList = row.FindControl("ddlResult4")
If Not dropList Is Nothing Then
If dataitem.SolutionResultId = 4 Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, dataitem.Resultid)
If Not dataitem.Operator Is Nothing Then
If dataitem.Operator <> String.Empty Then
dropList = row.FindControl("ddlOperator4")
dropList.SelectedValue = dataitem.Operator
End If
End If
End If
Else
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
'check if there is a value
ElseIf e.Item.OwnerTableView.IsItemInserted Then 'in add new mode
dropList = row.FindControl("ddlResult1")
If Not dropList Is Nothing Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
dropList = row.FindControl("ddlResult2")
If Not dropList Is Nothing Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
dropList = row.FindControl("ddlResult3")
If Not dropList Is Nothing Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
dropList = row.FindControl("ddlResult4")
If Not dropList Is Nothing Then
Helper.BindDropDownList(dropList, _SolutionResults, String.Empty, String.Empty)
End If
End If
End Sub
End Class