This is a migrated thread and some comments may be shown as answers.

Rebind RadGrid w/in Another RadGrid's EditFormTemplate

6 Answers 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon-Jon
Top achievements
Rank 2
Jon-Jon asked on 30 Jun 2011, 10:08 PM
I have RadGrid2 in RadGrid1's EditForm FormTemplate.  I have RadGrid2 being binded with the ItemCreated of RadGrid1 using advanced databinding.  I know that if you put the RadGrid2 within the NeedDataSource it will rebind automatically but I cannot access the ID of RadGrid2 in the RadGrid2_NeedDataSource in able to bind the data the first time.  So I use the GridEditFormItem FindControl to get the ID of RadGrid2 but cannot do that outside the RadGrid1_ItemCommand.

Any suggestions?

6 Answers, 1 is accepted

Sort by
0
Genti
Telerik team
answered on 06 Jul 2011, 10:48 AM
Hello Jonathan,

Thank you for contacting us.

Regarding 'I cannot access the ID of RadGrid2 in the RadGrid2_NeedDataSource'.
In such case, I suppose that the sender object, passed as first argument of the event handler is the RadGrid2 object. So, you can access its id from the:
RadGrid grid2 = (RadGrid)sender;
gri2.ID


And if you want to get the RadGrid1 object from the RadGrid2_NeedDataSouce than you can do the following:
GridEditFormItem insertItem = (GridEditFormItem)sender.NamingContainer;
RadGrid grid1 = insertItem.OwnerTableView.OwnerGrid;



I do not fully understand the situation by the description. So, if it is possible, can you try to prepare a simple project that illustrates what you are trying to achieve?


Greetings,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jon-Jon
Top achievements
Rank 2
answered on 06 Jul 2011, 03:15 PM
Here is the code.  If need anything else please let me know.  Thank you much!

Imports BusinessAdminBLL
Imports SqlCallsToDb
Imports System.IO
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Data
Imports Telerik.Web.UI
 
Partial Class MyScores_ComplaintsListing
    Inherits System.Web.UI.Page
    Private _sqlCon As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ToString)
    Private _sqlCom As SqlCommand = Nothing
    Private oPassThru As dalPassthru
    Private _strReportNumber As String = Nothing
    Private dt3 As DataTable
 
    Private Sub populateStoreNum(ByVal ddlstorenum As DropDownList)
        _sqlCom = New SqlCommand("GetStoreNumAndName", _sqlCon)
        _sqlCom.Parameters.AddWithValue("Business", Profile.Business)
        _sqlCom.CommandType = Data.CommandType.StoredProcedure
 
        Try
            If _sqlCon.State <> Data.ConnectionState.Open Then _sqlCon.Open()
            Dim dt As New DataTable
            Dim da As New SqlDataAdapter(_sqlCom)
            da.Fill(dt)
            ddlstorenum.DataTextField = "StoreNumAndName"
            ddlstorenum.DataValueField = "StoreNum"
            ddlstorenum.Items.Insert(0, "")
            For Each dr As DataRow In dt.Rows
                ddlstorenum.Items.Add(dr.ItemArray(0).ToString())
            Next
        Catch ex As Exception
            lblError.Text = ex.Message
 
        Finally
            If _sqlCon.State <> Data.ConnectionState.Closed Then _sqlCon.Close()
        End Try
    End Sub
 
    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("RMCPassThruConnectionString").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter
        adapter.SelectCommand = New SqlCommand(query, conn)
        Dim table1 As New DataTable
        conn.Open()
        Try
            adapter.Fill(table1)
        Finally
            conn.Close()
        End Try
        Return table1
    End Function
 
    Private Function fixPhoneNumber(ByVal PhoneNumber As String) As String
        PhoneNumber = Replace(PhoneNumber, " ", Nothing)
        PhoneNumber = Replace(PhoneNumber, "(", Nothing)
        PhoneNumber = Replace(PhoneNumber, ")", Nothing)
        PhoneNumber = Replace(PhoneNumber, "-", Nothing)
        PhoneNumber = Replace(PhoneNumber, ".", Nothing)
        Return PhoneNumber
    End Function
 
    Protected Sub Page_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        GetUserInfo(Profile.Business, HttpContext.Current.User.Identity.Name)
    End Sub
 
    Private Function SendEmails(ByVal CC As String) As String
        Return Nothing
    End Function
 
    Protected Sub grdComplaints_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdComplaints.DataBound
 
 
    End Sub
 
    Protected Sub grdComplaints_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles grdComplaints.NeedDataSource
 
        oPassThru = New dalPassthru
        _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaints", _sqlCon)
        _sqlCom.CommandType = Data.CommandType.StoredProcedure
        _sqlCom.CommandType = CommandType.StoredProcedure
        If _sqlCon.State <> ConnectionState.Open Then _sqlCon.Open()
        Dim dtgrdComplaints As New DataTable
        Dim dagrdComplaints As New SqlDataAdapter(_sqlCom)
        dagrdComplaints.Fill(dtgrdComplaints)
        grdComplaints.DataSource = dtgrdComplaints
        _sqlCon.Close()
 
    End Sub
 
    Protected Sub grdComplaints_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdComplaints.InsertCommand
 
        If (e.CommandName = "PerformInsert") Then
 
            Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
 
            oPassThru = New dalPassthru
            _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_InsertComplaint", _sqlCon)
            _sqlCom.CommandType = Data.CommandType.StoredProcedure
 
            _strReportNumber = Format(Now, "MMddyyHHmm")
 
            _sqlCom.Parameters.AddWithValue("Reportnumber", CInt(_strReportNumber))
            Dim ddlCustomerTitle As DropDownList = TryCast(editForm.FindControl("ddlCustomerTitle"), DropDownList)
            If Not String.IsNullOrEmpty(ddlCustomerTitle.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("Customertitle", ddlCustomerTitle.SelectedValue.ToUpper)
            End If
            Dim txtCustomerfirstnameI As TextBox = TryCast(editForm.FindControl("txtCustomerfirstnameI"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerfirstnameI.Text) Then
                txtCustomerfirstnameI.Text = Trim(txtCustomerfirstnameI.Text.Replace("'", Nothing))
                txtCustomerfirstnameI.Text = txtCustomerfirstnameI.Text(0).ToString.ToUpper & txtCustomerfirstnameI.Text.Remove(0, 1).ToLower
                _sqlCom.Parameters.AddWithValue("customerfirstname", txtCustomerfirstnameI.Text.ToUpper)
            End If
 
            Dim txtCustomerLastNameI As TextBox = TryCast(editForm.FindControl("txtCustomerLastNameI"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerLastNameI.Text) Then
                txtCustomerLastNameI.Text = Trim(txtCustomerLastNameI.Text.Replace("'", Nothing))
                txtCustomerLastNameI.Text = txtCustomerLastNameI.Text(0).ToString.ToUpper & txtCustomerLastNameI.Text.Remove(0, 1).ToLower
                _sqlCom.Parameters.AddWithValue("Customerlastname", txtCustomerLastNameI.Text.ToUpper)
            End If
 
            Dim txtCustomerPhone1 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone1"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerPhone1.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerphoneday", fixPhoneNumber(Trim(txtCustomerPhone1.Text)))
            End If
 
            Dim txtCustomerPhone2 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone1"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerPhone2.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerphoneevening", fixPhoneNumber(Trim(txtCustomerPhone2.Text)))
            End If
 
            Dim txtCustomerAddress1I As TextBox = TryCast(editForm.FindControl("txtCustomerAddress1I"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerAddress1I.Text) Then
                _sqlCom.Parameters.AddWithValue("Customeraddress1", Trim(txtCustomerAddress1I.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim txtCustomerAddress2I As TextBox = TryCast(editForm.FindControl("txtCustomerAddress2I"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerAddress2I.Text) Then
                _sqlCom.Parameters.AddWithValue("Customeraddress2", Trim(txtCustomerAddress2I.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim txtCustomerCityI As TextBox = TryCast(editForm.FindControl("txtCustomerCityI"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerCityI.Text) Then
                _sqlCom.Parameters.AddWithValue("Customercity", Trim(txtCustomerCityI.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim ddlCustomerStateI As DropDownList = TryCast(editForm.FindControl("ddlCustomerStateI"), DropDownList)
            _sqlCom.Parameters.AddWithValue("Customerstate", ddlCustomerStateI.SelectedValue)
 
            Dim txtCustomerzipcode As TextBox = TryCast(editForm.FindControl("txtCustomerzipcode"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerzipcode.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerzipcode", CInt(Trim(txtCustomerzipcode.Text.Replace("'", Nothing))))
            End If
 
            Dim txtCustomerCountry As TextBox = TryCast(editForm.FindControl("txtCustomerCountry"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerCountry.Text) Then
                _sqlCom.Parameters.AddWithValue("customercountry", Trim(txtCustomerCountry.Text.Replace("'", Nothing)))
            End If
 
            Dim txtBesttime As TextBox = TryCast(editForm.FindControl("txtBesttime"), TextBox)
            If Not String.IsNullOrEmpty(txtBesttime.Text) Then
                _sqlCom.Parameters.AddWithValue("Besttime", Trim(txtBesttime.Text.Replace("'", Nothing)))
            End If
 
            Dim txtIncidentDate As TextBox = TryCast(editForm.FindControl("txtIncidentDate"), TextBox)
            If Not String.IsNullOrEmpty(txtIncidentDate.Text) Then
                _sqlCom.Parameters.AddWithValue("Incidentdate", Trim(txtIncidentDate.Text.Replace("'", Nothing)))
            End If
 
            Dim txtIncidenttime As TextBox = TryCast(editForm.FindControl("txtIncidenttime"), TextBox)
            If Not String.IsNullOrEmpty(txtIncidenttime.Text) Then
                _sqlCom.Parameters.AddWithValue("Incidenttime", Trim(txtIncidenttime.Text.Replace("'", Nothing)))
            End If
 
            Dim ddlServicetype As DropDownList = TryCast(editForm.FindControl("ddlServicetype"), DropDownList)
            If Not String.IsNullOrEmpty(ddlServicetype.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("servicetype", ddlServicetype.SelectedValue)
            End If
 
            Dim chkAdjustmentindicator As CheckBox = TryCast(editForm.FindControl("chkAdjustmentindicator"), CheckBox)
            _sqlCom.Parameters.AddWithValue("Adjustmentindicator", chkAdjustmentindicator.Checked)
 
            Dim txtFinalamountspent As TextBox = TryCast(editForm.FindControl("txtFinalamountspent"), TextBox)
            If Not String.IsNullOrEmpty(Trim(txtFinalamountspent.Text)) Then
                _sqlCom.Parameters.AddWithValue("Finalamountspent", Trim(txtFinalamountspent.Text))
            End If
 
            Dim txtRefundamount As TextBox = TryCast(editForm.FindControl("txtRefundamount"), TextBox)
            If Not String.IsNullOrEmpty(Trim(txtRefundamount.Text)) Then
                _sqlCom.Parameters.AddWithValue("Refundamount", Trim(txtRefundamount.Text))
            End If
 
            Dim chkRestaurantcontact As CheckBox = TryCast(editForm.FindControl("chkRestaurantcontact"), CheckBox)
            _sqlCom.Parameters.AddWithValue("restaurantcontact", chkRestaurantcontact.Checked)
 
            Dim chkFollowuprequestedflag As CheckBox = TryCast(editForm.FindControl("chkFollowuprequestedflag"), CheckBox)
            _sqlCom.Parameters.AddWithValue("CustomerContact", chkFollowuprequestedflag.Checked)
 
            Dim ddlContactMethod As DropDownList = TryCast(editForm.FindControl("ddlContactMethod"), DropDownList)
            If Not String.IsNullOrEmpty(ddlContactMethod.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("ContactBy", ddlContactMethod.SelectedValue)
            End If
 
            Dim ddlStoreNum As DropDownList = TryCast(editForm.FindControl("ddlStoreNum"), DropDownList)
            If Not String.IsNullOrEmpty(ddlStoreNum.SelectedValue) Then
                Dim storenum As String = ddlStoreNum.SelectedValue.ToString()
                Dim index As Integer = storenum.IndexOf(" ")
                storenum = storenum.Substring(0, index)
                _sqlCom.Parameters.AddWithValue("Storenum", CInt(storenum))
            End If
 
            Dim txtOperatorid As TextBox = TryCast(editForm.FindControl("txtOperatorid"), TextBox)
            _sqlCom.Parameters.AddWithValue("Operatorid", txtOperatorid.Text.ToUpper)
 
            Dim txtEmailid As TextBox = TryCast(editForm.FindControl("txtEmailid"), TextBox)
            If Not String.IsNullOrEmpty(txtEmailid.Text) Then
                _sqlCom.Parameters.AddWithValue("Emailid", Trim(txtEmailid.Text.Replace("'", Nothing)))
            End If
 
            Dim txtComments As TextBox = TryCast(editForm.FindControl("txtComments"), TextBox)
            _sqlCom.Parameters.AddWithValue("Comments1", Trim(HttpUtility.HtmlEncode(txtComments.Text.Replace("'", "''"))))
 
            Dim backward As String = StrReverse(Format(Now, "hhmmss"))
            _sqlCom.Parameters.AddWithValue("incidentnumber", CType(backward, Integer))
            Session("incidentnumber") = backward
 
            Dim intReturn As Int16 = -1
            Dim blnSuccess As Boolean = False
            Try
                If _sqlCon.State <> Data.ConnectionState.Open Then _sqlCon.Open()
                intReturn = _sqlCom.ExecuteNonQuery()
                blnSuccess = True
 
            Catch ex As Exception
                lblError.Text &= "There was an error submitting your complaint. Please contact Technical Support.<br />Error Details: " & Err.Number & " - " & ex.Message & "<br />"
 
            Finally
                If _sqlCon.State <> Data.ConnectionState.Closed Then _sqlCon.Close()
            End Try
        End If
 
    End Sub
 
    Protected Sub grdComplaints_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdComplaints.InsertCommand
 
        If (e.CommandName = RadGrid.EditCommandName) Then
 
        End If
 
        If (e.CommandName = "Insert") Then
 
        End If
 
    End Sub
 
    Protected Sub grdComplaints_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdComplaints.SelectedIndexChanged
        Dim rn As Integer
        rn = grdComplaints.SelectedItems(0).OwnerTableView.DataKeyValues(grdComplaints.SelectedItems(0).ItemIndex)("reportnumber")
    End Sub
 
    Protected Sub grdComplaints_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles grdComplaints.ItemCreated
 
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
 
            If e.Item.OwnerTableView.IsItemInserted Then
 
                Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
                Dim DetailsPanel As Panel = TryCast(editForm.FindControl("DetailsPanel"), Panel)
                DetailsPanel.Visible = False
                Dim InsertPanel As Panel = TryCast(editForm.FindControl("InsertPanel"), Panel)
                InsertPanel.Visible = True
                Dim ddlstorenum As DropDownList = TryCast(editForm.FindControl("ddlstorenum"), DropDownList)
                populateStoreNum(ddlstorenum)
                Dim txtoperatorid As TextBox = TryCast(editForm.FindControl("txtoperatorid"), TextBox)
                txtoperatorid.Text = User.Identity.Name
 
            Else
 
                Dim SumDb As String
                oPassThru = New dalPassthru
                SumDb = oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo"
                Dim rn As Integer
                rn = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("reportnumber")
                Dim dt As DataTable
                dt = GetDataTable("SELECT " & _
        "a.ReportNumber, " & _
        "a.IncidentNumber, " & _
        "a.CustomerFirstName, " & _
        "a.customeraddress1, " & _
        "a.customeraddress2, " & _
        "a.customercity, " & _
        "a.customerstate, " & _
        "a.customerzipcode, " & _
        "a.customerphoneday, " & _
        "a.customerphoneevening, " & _
        "a.besttimecontactfromday, " & _
        "a.besttimecontacttoday, " & _
        "a.besttimecontactfromeve, " & _
        "a.besttimecontacttoeve, " & _
        "a.ReportDate, " & _
        "a.CustomerLastName, " & _
        "a.CustomerContact, " & _
        "a.storenum, " & _
        "a.servicetype, " & _
        "a.incidentdate, " & _
        "a.followuprequestedflag, " & _
        "a.finalamountspent,  " & _
        "a.incidenttime,  " & _
        "a.contactby, " & _
        "a.calllvl1number, " & _
        "a.calllvl2number, " & _
        "a.calllvl3number, " & _
        "a.calllvl4number, " & _
        "a.calllvl5number, " & _
        "a.calllvl6number, " & _
        "a.calllvl7number, " & _
        "s.Comments1, " & _
        "s.assignedto, " & _
        "s.statusid, " & _
        "s.emailid, " & _
        "a.incidentnotes, " & _
        "c.optionitem, " & _
        "a.assignedto " & _
        "FROM " & SumDb & ".PRC_ComplaintsAuto a INNER JOIN " & SumDb & ".PRC_ComplaintsStatus s ON a.reportnumber = s.reportnumber INNER JOIN " & SumDb & ".PRC_complainttrackingoptions c ON s.statusid = c.OptionId WHERE a.reportnumber = " & rn)
 
                Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
 
                Dim DetailsPanel As Panel = TryCast(editForm.FindControl("DetailsPanel"), Panel)
                DetailsPanel.Visible = True
 
                Dim InsertPanel As Panel = TryCast(editForm.FindControl("InsertPanel"), Panel)
                InsertPanel.Visible = False
 
                Dim lblAssignedTo As Label = TryCast(editForm.FindControl("lblAssignedTo"), Label)
                lblAssignedTo.Text = dt.Rows(0).ItemArray(37).ToString()
                Session("AssignedTo") = dt.Rows.Item(0).ItemArray(37).ToString()
 
                Dim lblstatus As Label = TryCast(editForm.FindControl("lblstatus"), Label)
                lblstatus.Text = dt.Rows(0).ItemArray(36).ToString()
                Session("status") = lblstatus.Text.ToString()
 
                Dim lblReportDate As Label = TryCast(editForm.FindControl("lblReportDate"), Label)
                lblReportDate.Text = dt.Rows(0).ItemArray(14).ToString()
 
                Dim lblreportnumber As Label = TryCast(editForm.FindControl("lblreportnumber"), Label)
                lblreportnumber.Text = dt.Rows(0).ItemArray(0).ToString()
                Session("reportnumber") = dt.Rows(0).ItemArray(0).ToString()
 
                Dim lblIncidentNumber As Label = TryCast(editForm.FindControl("lblIncidentNumber"), Label)
                lblIncidentNumber.Text = dt.Rows(0).ItemArray(1).ToString()
                Session("incidentnumber") = dt.Rows(0).ItemArray(1).ToString()
 
                Dim lblStoreNum As Label = TryCast(editForm.FindControl("lblStoreNum"), Label)
                lblStoreNum.Text = dt.Rows(0).ItemArray(17).ToString()
 
                Dim txtCustomerFirstName As TextBox = TryCast(editForm.FindControl("txtCustomerFirstName"), TextBox)
                txtCustomerFirstName.Text = dt.Rows(0).ItemArray(2).ToString()
 
                Dim txtCustomerLastName As TextBox = TryCast(editForm.FindControl("txtCustomerLastName"), TextBox)
                txtCustomerLastName.Text = dt.Rows(0).ItemArray(15).ToString()
 
                Dim txtCustomerAddress1 As TextBox = TryCast(editForm.FindControl("txtCustomerAddress1"), TextBox)
                txtCustomerAddress1.Text = dt.Rows(0).ItemArray(3).ToString()
 
                Dim txtCustomerAddress2 As TextBox = TryCast(editForm.FindControl("txtCustomerAddress2"), TextBox)
                txtCustomerAddress2.Text = dt.Rows(0).ItemArray(4).ToString()
 
                Dim txtCustomerCity As TextBox = TryCast(editForm.FindControl("txtCustomerCity"), TextBox)
                txtCustomerCity.Text = dt.Rows(0).ItemArray(5).ToString()
 
                Dim ddlCustomerState As DropDownList = TryCast(editForm.FindControl("ddlCustomerState"), DropDownList)
                ddlCustomerState.SelectedItem.Text = dt.Rows(0).ItemArray(6).ToString()
 
                Dim txtCustomerZip As TextBox = TryCast(editForm.FindControl("txtCustomerZip"), TextBox)
                txtCustomerZip.Text = dt.Rows(0).ItemArray(7).ToString()
 
                Dim txtCustomerPhone1 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone1"), TextBox)
                txtCustomerPhone1.Text = dt.Rows(0).ItemArray(8).ToString()
                Session("phone1") = dt.Rows(0).ItemArray(8).ToString()
 
                Dim txtCustomerPhone2 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone2"), TextBox)
                txtCustomerPhone2.Text = dt.Rows(0).ItemArray(9).ToString()
                Session("phone2") = dt.Rows(0).ItemArray(9).ToString()
 
                Dim txtCustomerEmail As TextBox = TryCast(editForm.FindControl("txtCustomerEmail"), TextBox)
                txtCustomerEmail.Text = dt.Rows(0).ItemArray(34).ToString()
 
                Dim txtCustomerBestTime As TextBox = TryCast(editForm.FindControl("txtCustomerBestTime"), TextBox)
                txtCustomerBestTime.Text = "DAY: " & dt.Rows(0).ItemArray(10).ToString() & " to " & dt.Rows(0).ItemArray(11).ToString() & _
                " | NIGHT: " & dt.Rows(0).ItemArray(12).ToString() & " to " & dt.Rows(0).ItemArray(13).ToString()
 
                Dim lblCustomerUpdateResult As Label = TryCast(editForm.FindControl("lblCustomerUpdateResult"), Label)
                lblCustomerUpdateResult.Text = dt.Rows(0).ItemArray(20).ToString()
 
                Dim lblCI_Type As Label = TryCast(editForm.FindControl("lblCI_Type"), Label)
                lblCI_Type.Text = dt.Rows(0).ItemArray(18).ToString()
 
                Dim lblCI_FinalAmtSpent As Label = TryCast(editForm.FindControl("lblCI_FinalAmtSpent"), Label)
                lblCI_FinalAmtSpent.Text = dt.Rows(0).ItemArray(21).ToString()
 
                Dim lblCI_IncidentDate As Label = TryCast(editForm.FindControl("lblCI_IncidentDate"), Label)
                lblCI_IncidentDate.Text = dt.Rows(0).ItemArray(19).ToString()
 
                Dim lblCI_IncidentTime As Label = TryCast(editForm.FindControl("lblCI_IncidentTime"), Label)
                lblCI_IncidentTime.Text = dt.Rows(0).ItemArray(22).ToString()
 
                Dim lblCI_ReqContact As Label = TryCast(editForm.FindControl("lblCI_ReqContact"), Label)
                lblCI_ReqContact.Text = dt.Rows(0).ItemArray(20).ToString()
 
                Dim lblCI_ReqContactBy As Label = TryCast(editForm.FindControl("lblCI_ReqContactBy"), Label)
                lblCI_ReqContactBy.Text = dt.Rows(0).ItemArray(23).ToString()
 
                Dim lblCI_ContactStore As Label = TryCast(editForm.FindControl("lblCI_ContactStore"), Label)
                lblCI_ContactStore.Text = dt.Rows(0).ItemArray(16).ToString()
 
                Dim lblCI_Comments As Label = TryCast(editForm.FindControl("lblCI_Comments"), Label)
                lblCI_Comments.Text = dt.Rows(0).ItemArray(35).ToString()
 
 
                oPassThru = New dalPassthru
                _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_Complaints_GetProblemDescr", _sqlCon)
                _sqlCom.CommandType = Data.CommandType.StoredProcedure
                _sqlCom.CommandType = CommandType.StoredProcedure
                _sqlCom.Parameters.AddWithValue("ReportNumber", CInt(lblreportnumber.Text))
                If _sqlCon.State <> ConnectionState.Open Then _sqlCon.Open()
                Dim dt2 As New DataTable
                Dim da2 As New SqlDataAdapter(_sqlCom)
                da2.Fill(dt2)
                Dim sbLitCategory As New StringBuilder
                If (dt2.Rows.Count <> 0) Then
                    For Each dr As DataRow In dt2.Rows
                        sbLitCategory.AppendLine("<ul style='margin-top: 1px;'>")
                        sbLitCategory.Append("<li>")
                        If Not IsDBNull(dr.Item("Problem1")) Then
                            sbLitCategory.Append(dr.Item("Problem1")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem2")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem2")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem3")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem3")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem4")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem4")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem5")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem5")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem6")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem6")).ToString.Trim()
                        End If
                        If Not IsDBNull(dr.Item("Problem7")) Then
                            sbLitCategory.Append(".")
                            sbLitCategory.Append(dr.Item("Problem7")).ToString.Trim()
                        End If
                        sbLitCategory.Append("</li>")
                        sbLitCategory.AppendLine("</ul>")
                    Next
                    _sqlCon.Close()
                End If
                Dim litCategory As Literal = TryCast(editForm.FindControl("litCategory"), Literal)
                litCategory.Text = sbLitCategory.ToString
 
                Dim rgCHistory As RadGrid = TryCast(editForm.FindControl("rgCHistory"), RadGrid)
                _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaintTracking", _sqlCon)
                _sqlCom.CommandType = Data.CommandType.StoredProcedure
                _sqlCom.CommandType = CommandType.StoredProcedure
                _sqlCom.Parameters.AddWithValue("ReportNumber", CInt(Session("reportnumber")))
                If _sqlCon.State <> ConnectionState.Open Then _sqlCon.Open()
                Dim dt3 As New DataTable
                Dim da3 As New SqlDataAdapter(_sqlCom)
                da3.Fill(dt3)
                rgCHistory.DataSource = dt3
                _sqlCon.Close()
 
                If Not String.IsNullOrEmpty(Session("phone1").ToString) Or Not String.IsNullOrEmpty(Session("phone2").ToString) Then
                    oPassThru = New dalPassthru
                    _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaintHistory", _sqlCon)
                    _sqlCom.CommandType = CommandType.StoredProcedure
                    _sqlCom.Parameters.AddWithValue("Reportnumber", Session("reportnumber").ToString())
                    _sqlCom.Parameters.AddWithValue("Phone1", IIf(Not String.IsNullOrEmpty(Session("phone1").ToString), Left(Session("phone1").ToString, 10), Right(Session("phone2").ToString, 10)))
                    If Not String.IsNullOrEmpty(Session("phone2").ToString) Then
                        _sqlCom.Parameters.AddWithValue("Phone2", Right(Session("phone2").ToString, 10))
                    End If
                    Dim sbLiteral As New StringBuilder
                    Dim strDT As String = Nothing
                    Dim sqlDr As SqlDataReader = Nothing
                    If _sqlCon.State <> ConnectionState.Open Then _sqlCon.Open()
                    Try
                        sqlDr = _sqlCom.ExecuteReader
                        If sqlDr.HasRows Then
                            sbLiteral.AppendLine("<ul>")
                            While sqlDr.Read
                                strDT = sqlDr("incidentdate").ToString
                                If IsDate(strDT) Then strDT = Format(CDate(strDT), "MMMM.dd.yyyy")
                                Dim QueryString As String = Nothing
                                If Request.QueryString.HasKeys Then
                                    QueryString = Request.RawUrl.Split("?")(1)
                                    If QueryString.Contains("&") Then
                                        QueryString = QueryString.Remove(0, QueryString.IndexOf("&"))
                                    End If
                                End If
                                sbLiteral.Append("<li><a href = " & "'CompDetails.aspx?rn=" & sqlDr("reportnumber").ToString & QueryString & "'>" & sqlDr("reportnumber").ToString & "</a> - ")
                                sbLiteral.Append(strDT & " : ")
                                If Len(sqlDr("comment").ToString) > 100 Then
                                    sbLiteral.Append(sqlDr("comment").ToString.Substring(0, 97) & "...</li>")
                                Else
                                    sbLiteral.Append(sqlDr("comment").ToString & "</li>")
                                End If
                            End While
                            sbLiteral.AppendLine("</ul>")
                        End If
 
                        Dim litHistory As Literal = TryCast(editForm.FindControl("litHistory"), Literal)
                        litHistory.Text = sbLiteral.ToString
                    Catch ex As Exception
                        lblError.Text &= "There was an error getting history for this complaint. Please contact Customer Support - Error CR03<br />Details: '" & ex.Message & "'<br />"
                    Finally
                        sqlDr.Close()
                    End Try
                End If
            End If
            _sqlCon.Close()
 
        End If
    End Sub
 
    Protected Sub grdComplaints_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdComplaints.ItemDataBound
 
 
    End Sub
 
    Protected Sub grdComplaints_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdComplaints.UpdateCommand
 
        If (e.CommandName = "Update") Then
 
            Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
 
            oPassThru = New dalPassthru
            _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_UpdateComplaintCustomer", _sqlCon)
            _sqlCom.CommandType = Data.CommandType.StoredProcedure
 
            _sqlCom.Parameters.AddWithValue("Reportnumber", CInt(Session("reportnumber")))
            Dim ddlCustomerTitle As DropDownList = TryCast(editForm.FindControl("ddlCustomerTitle"), DropDownList)
            If Not String.IsNullOrEmpty(ddlCustomerTitle.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("Customertitle", ddlCustomerTitle.SelectedValue.ToUpper)
            End If
            Dim txtCustomerfirstnameI As TextBox = TryCast(editForm.FindControl("txtCustomerfirstname"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerfirstnameI.Text) Then
                txtCustomerfirstnameI.Text = Trim(txtCustomerfirstnameI.Text.Replace("'", Nothing)).ToUpper
                txtCustomerfirstnameI.Text = txtCustomerfirstnameI.Text(0).ToString.ToUpper & txtCustomerfirstnameI.Text.Remove(0, 1).ToUpper
                _sqlCom.Parameters.AddWithValue("customerfirstname", txtCustomerfirstnameI.Text.ToUpper)
            End If
 
            Dim txtCustomerLastNameI As TextBox = TryCast(editForm.FindControl("txtCustomerLastName"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerLastNameI.Text) Then
                txtCustomerLastNameI.Text = Trim(txtCustomerLastNameI.Text.Replace("'", Nothing))
                txtCustomerLastNameI.Text = txtCustomerLastNameI.Text(0).ToString.ToUpper & txtCustomerLastNameI.Text.Remove(0, 1).ToUpper
                _sqlCom.Parameters.AddWithValue("Customerlastname", txtCustomerLastNameI.Text.ToUpper)
            End If
 
            Dim txtCustomerPhone1 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone1"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerPhone1.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerphoneday", fixPhoneNumber(Trim(txtCustomerPhone1.Text)))
            End If
 
            Dim txtCustomerPhone2 As TextBox = TryCast(editForm.FindControl("txtCustomerPhone1"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerPhone2.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerphoneevening", fixPhoneNumber(Trim(txtCustomerPhone2.Text)))
            End If
 
            Dim txtCustomerAddress1I As TextBox = TryCast(editForm.FindControl("txtCustomerAddress1"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerAddress1I.Text) Then
                _sqlCom.Parameters.AddWithValue("Customeraddress1", Trim(txtCustomerAddress1I.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim txtCustomerAddress2I As TextBox = TryCast(editForm.FindControl("txtCustomerAddress2"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerAddress2I.Text) Then
                _sqlCom.Parameters.AddWithValue("Customeraddress2", Trim(txtCustomerAddress2I.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim txtCustomerCityI As TextBox = TryCast(editForm.FindControl("txtCustomerCity"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerCityI.Text) Then
                _sqlCom.Parameters.AddWithValue("Customercity", Trim(txtCustomerCityI.Text.Replace("'", Nothing).ToUpper))
            End If
 
            Dim ddlCustomerStateI As DropDownList = TryCast(editForm.FindControl("ddlCustomerState"), DropDownList)
            _sqlCom.Parameters.AddWithValue("Customerstate", ddlCustomerStateI.SelectedValue)
 
            Dim txtCustomerzipcode As TextBox = TryCast(editForm.FindControl("txtCustomerzipcode"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerzipcode.Text) Then
                _sqlCom.Parameters.AddWithValue("Customerzipcode", CInt(Trim(txtCustomerzipcode.Text.Replace("'", Nothing))))
            End If
 
            Dim txtCustomerEmail As TextBox = TryCast(editForm.FindControl("txtCustomerEmail"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerEmail.Text) Then
                _sqlCom.Parameters.AddWithValue("Emailid", Trim(txtCustomerEmail.Text.Replace("'", Nothing)))
            End If
 
            Dim txtCustomerBestTime As TextBox = TryCast(editForm.FindControl("txtCustomerBestTime"), TextBox)
            If Not String.IsNullOrEmpty(txtCustomerBestTime.Text) Then
                Dim best As String
                best = Trim(txtCustomerBestTime.Text.Replace("DAY: ", Nothing))
                best = Trim(best.Replace("| NIGHT: ", Nothing))
                best = Trim(best.Replace("to", Nothing))
                _sqlCom.Parameters.AddWithValue("Besttime", best.ToString())
            End If
 
            Dim intReturn As Int16 = -1
            Dim blnSuccess As Boolean = False
            Try
                If _sqlCon.State <> Data.ConnectionState.Open Then _sqlCon.Open()
                intReturn = _sqlCom.ExecuteNonQuery()
                blnSuccess = True
 
            Catch ex As Exception
                lblError.Text &= "There was an error updating your complaint. Please contact Technical Support.<br />Error Details: " & Err.Number & " - " & ex.Message & "<br />"
 
            Finally
                If _sqlCon.State <> Data.ConnectionState.Closed Then _sqlCon.Close()
            End Try
        End If
        e.Canceled = True
    End Sub
 
    Protected Sub rgCHistory_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgCHistory.InsertCommand
        Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
        Dim lblActivityMessage As Label = TryCast(editForm.FindControl("lblActivityMessage"), Label)
        lblActivityMessage.Text = Nothing
        Dim strResult As String = Nothing
 
 
        If (e.CommandName = "PerformInsert") Then
 
            oPassThru = New dalPassthru
            _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_InsertComplaintTracking", _sqlCon)
            _sqlCom.CommandType = Data.CommandType.StoredProcedure
 
            _sqlCom.Parameters.AddWithValue("Reportnumber", CInt(Session("reportnumber")))
            _sqlCom.Parameters.AddWithValue("incidentnumber", CInt(Session("incidentnumber")))
 
            Dim ddlResult As DropDownList = TryCast(editForm.FindControl("ddlResult"), DropDownList)
            If Not String.IsNullOrEmpty(ddlResult.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("resultid", CInt(ddlResult.SelectedValue))
                _sqlCom.Parameters.AddWithValue("result", ddlResult.SelectedItem.Text)
            End If
 
            _sqlCom.Parameters.AddWithValue("AssignedBy", User.Identity.Name)
 
            Dim ddlassignedto As DropDownList = TryCast(editForm.FindControl("ddlassignedto"), DropDownList)
            If Not String.IsNullOrEmpty(ddlassignedto.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("assignedto", ddlassignedto.SelectedItem.Text)
            End If
 
            Dim ddlStatus As DropDownList = TryCast(editForm.FindControl("ddlStatus"), DropDownList)
            If Not String.IsNullOrEmpty(ddlStatus.SelectedValue) Then
                _sqlCom.Parameters.AddWithValue("Statusid", CInt(ddlStatus.SelectedValue))
                _sqlCom.Parameters.AddWithValue("Status", ddlStatus.SelectedItem.Text)
            End If
 
            Dim txtnotes As TextBox = TryCast(editForm.FindControl("txtnotes"), TextBox)
            Dim strNotes As String = HttpUtility.HtmlEncode(txtnotes.Text.Replace("'", "''"))
            _sqlCom.Parameters.AddWithValue("comments1", txtnotes.Text.Trim())
 
            _sqlCom.Parameters.AddWithValue("UpdatedBy", User.Identity.Name)
 
            Dim txtcopyto As TextBox = TryCast(editForm.FindControl("txtcopyto"), TextBox)
            _sqlCom.Parameters.AddWithValue("CC", txtcopyto.Text.Trim())
 
            Dim intResult As Int16
            Try
                If _sqlCon.State <> Data.ConnectionState.Open Then _sqlCon.Open()
                intResult = _sqlCom.ExecuteNonQuery()
 
            Catch ex As Exception
                lblError.Text &= "There was an error processing your request: '" & ex.Message & "'<br />"
 
            Finally
                If _sqlCon.State <> Data.ConnectionState.Closed Then _sqlCon.Close()
            End Try
 
          
            strResult = "New activity has been saved.<br />"
            strResult &= SendEmails(txtcopyto.ToString())
 
            'STEP 3: Update paged based on the status of complaint
            Select Case Left(ddlStatus.SelectedItem.Text, 6).ToLower
                Case "closed"
                    lblError.Text &= "Thank you for taking care of this complaint.<br />"
                    'Response.Redirect("ty.aspx?1&" & Request.RawUrl.Split("?")(1), False)
 
                Case Else 'set status field in complaintsauto to 'open'
                    If LCase(Session("status").ToString).ToLower <> "open" Then
                        strResult &= "This complaint's status is now set to 'Open'. "
 
                    End If
            End Select
 
            lblActivityMessage.Text = strResult & "<br />"
 
        End If
 
    End Sub
 
    Protected Sub rgCHistory_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgCHistory.ItemCommand
        If (e.CommandName = RadGrid.EditCommandName) Then
 
        End If
 
        If (e.CommandName = "InitInsert") Then
 
        End If
    End Sub
 
    Protected Sub rgCHistory_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgCHistory.ItemCreated
 
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
            If e.Item.OwnerTableView.IsItemInserted Then
                Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
                Dim ddlstatus As DropDownList = TryCast(editForm.FindControl("ddlstatus"), DropDownList)
                Dim ddlResult As DropDownList = TryCast(editForm.FindControl("ddlResult"), DropDownList)
                If ddlstatus.Items.Count = 0 AndAlso ddlResult.Items.Count = 0 Then
                    oPassThru = New dalPassthru
                    _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaintOptionsStatus", _sqlCon)
                    Dim sqlDT As DataTable = getDataSource_DataTable(_sqlCom)
                    ddlstatus.DataSource = sqlDT.Select("OptionCategory = 'status'").CopyToDataTable
                    ddlstatus.DataValueField = "OptionId"
                    ddlstatus.DataTextField = "OptionItem"
                    ddlstatus.DataBind()
                    ddlResult.DataSource = sqlDT.Select("OptionCategory = 'result'").CopyToDataTable
                    ddlResult.DataValueField = "OptionId"
                    ddlResult.DataTextField = "OptionItem"
                    ddlResult.DataBind()
                    ddlResult.Items(0).Value = Nothing
                    'ddlstatus.SelectedValue = Session("status").ToString()
 
                End If
                Dim ddlAssignedTo As DropDownList = TryCast(editForm.FindControl("ddlAssignedTo"), DropDownList)
                If ddlAssignedTo.Items.Count = 0 Then
                    oPassThru = New dalPassthru
                    _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString & ".dbo.PRC_web_SelectComplaintAssignments", _sqlCon)
                    ddlAssignedTo.DataSource = getDataSource_DataTable(_sqlCom)
                    ddlAssignedTo.DataBind()
                End If
                Dim lblAssignedTo As String
                lblAssignedTo = Session("assignedto").ToString()
                If Not String.IsNullOrEmpty(lblAssignedTo) AndAlso ddlAssignedTo.Items.IndexOf(ddlAssignedTo.Items.FindByValue(lblAssignedTo.ToLower)) > -1 Then
                    ddlAssignedTo.Items.FindByValue(lblAssignedTo.ToLower).Selected = True
                ElseIf ddlAssignedTo.Items.IndexOf(ddlAssignedTo.Items.FindByValue(User.Identity.Name.ToLower)) > -1 Then
                    ddlAssignedTo.Items.FindByValue(User.Identity.Name.ToLower).Selected = True
                End If
 
            End If
        End If
 
    End Sub
 
    Protected Sub rgCHistory_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgCHistory.NeedDataSource
        oPassThru = New dalPassthru
        _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaintTracking", _sqlCon)
        _sqlCom.CommandType = Data.CommandType.StoredProcedure
        _sqlCom.CommandType = CommandType.StoredProcedure
        _sqlCom.Parameters.AddWithValue("ReportNumber", CInt(Session("reportnumber")))
        If _sqlCon.State <> ConnectionState.Open Then _sqlCon.Open()
        Dim dt3 As New DataTable
        Dim da3 As New SqlDataAdapter(_sqlCom)
        da3.Fill(dt3)
        rgCHistory.DataSource = dt3
        _sqlCon.Close()
    End Sub
End Class





<%@ Page Language="VB" MasterPageFile="~/MasterPages/mlCalendar.master" AutoEventWireup="false"
    CodeFile="ComplaintsListing.aspx.vb" Inherits="MyScores_ComplaintsListing" Title="Complaint Listing" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHeader" runat="Server">
    <%--<link href="../CSS/Complaints.css" rel="stylesheet" type="text/css" />--%>
    <link href="../CSS/MyCustomSkin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderCalendar" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Reports2ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel_GridView" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div class="dialog" style="margin-top: 5px;">
                <div class="header">
                    <div class="outer">
                        <div class="inner">
                            <div class="content">
                                <asp:Label ID="lblCurrentFilter" runat="server" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="body">
                    <div class="outer">
                        <div class="inner">
                            <div class="content">
                                <telerik:RadGrid ID="grdComplaints" runat="server" OnNeedDataSource="grdComplaints_NeedDataSource"
                                    OnSelectedIndexChanged="grdComplaints_SelectedIndexChanged" OnDataBound="grdComplaints_DataBound"
                                    OnItemDataBound="grdComplaints_ItemDataBound" EnableViewState="true" AllowAutomaticInserts="false"
                                    AllowAutomaticUpdates="false" Skin="MyCustomSkin" BorderWidth="0px" BorderStyle="None"
                                    EnableEmbeddedSkins="false" PageSize="15" Width="975px" AutoGenerateColumns="False"
                                    AllowSorting="True" AllowPaging="True" AllowFilteringByColumn="true" OrderBy="ReportDate Desc"
                                    UseHoverOverChangeColor="false" UseDoubleClickSelect="false" ShowGoToPage="true"
                                    ShowStatusBar="true" GridLines="Horizontal" UseCustomPagerTemplate="true" DisplaySortingArrows="true"
                                    DataKeyNames="ReportNumber">
                                    <HeaderStyle Wrap="false" />
                                    <MasterTableView Width="100%" PageSize="10" DataKeyNames="reportnumber" CommandItemDisplay="Top">
                                        <Columns>
                                            <telerik:GridNumericColumn DataField="reportnumber" HeaderText="Report Number" HeaderStyle-Width="100px"
                                                FilterControlWidth="50px" />
                                            <telerik:GridDateTimeColumn DataField="reportdate" DataFormatString="{0:MM/dd/yyyy}"
                                                HeaderText="Report Date" />
                                            <telerik:GridBoundColumn DataField="customerlastname" HeaderText="Customer Last Name" />
                                            <telerik:GridBoundColumn DataField="customercontact" HeaderText="Customer Contact" />
                                            <telerik:GridNumericColumn DataField="storenum" HeaderText="Store Number" HeaderStyle-Width="100px"
                                                FilterControlWidth="50px" />
                                            <telerik:GridBoundColumn DataField="Comments1" HeaderText="Comments" />
                                            <telerik:GridBoundColumn DataField="assignedto" HeaderText="Assigned To" />
                                            <telerik:GridBoundColumn DataField="optionitem" HeaderText="Status" />
                                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
                                                <HeaderStyle Width="20px" />
                                            </telerik:GridEditCommandColumn>
                                        </Columns>
                                        <EditFormSettings EditFormType="Template">
                                            <FormTemplate>
                                                <asp:Panel ID="DetailsPanel" runat="server">
                                                    <div style="text-align: left;">
                                                        <asp:UpdatePanel ID="UpdatePanel_Error" runat="server" UpdateMode="Conditional" RenderMode="Inline">
                                                            <ContentTemplate>
                                                                <asp:Label ID="lblError2" runat="server" ForeColor="Red" EnableViewState="false" />
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <div class="sectionHeader">
                                                            Complaint Detail
                                                        </div>
                                                        <asp:UpdatePanel ID="UpdatePanel_ComplaintHeaderDetail" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <table style="float: left; margin-left: 75px; margin-right: 50px;" class="contentSection">
                                                                    <tr>
                                                                        <th align="right">
                                                                            Assigned To:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblAssignedTo" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th align="right">
                                                                            Status:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblStatus" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th align="right">
                                                                            Report Date:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblReportDate" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th align="right">
                                                                            Report Number:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblreportnumber" runat="server" Font-Italic="True" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th align="right">
                                                                            Incident Number:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblIncidentNumber" runat="server" Font-Italic="True" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <asp:UpdatePanel ID="UpdatePanel_StoreInfo" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <table style="float: left;" class="contentSection">
                                                                    <tr>
                                                                        <th align="right" style="width: 95px;">
                                                                            Division:
                                                                        </th>
                                                                        <td style="width: 300px;">
                                                                            <asp:Label ID="lblDivision" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th align="right" valign="top">
                                                                            Store:
                                                                        </th>
                                                                        <td>
                                                                            <asp:Label ID="lblStoreNum" runat="server" /><asp:Label ID="lblStore" runat="server" />
                                                                            <br />
                                                                            <asp:Literal ID="litStoreAddy" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td colspan="2">
                                                                            <asp:Panel ID="pnlUpdateStore" runat="server" Visible="false" Style="margin-left: 100px">
                                                                                <br />
                                                                                This report belongs to store:
                                                                                <br />
                                                                                <asp:DropDownList ID="ddlUpdateStore" runat="server" />
                                                                                <asp:Button ID="btnUpdateStore" runat="server" Text="OK" />
                                                                            </asp:Panel>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td colspan="2">
                                                                            <asp:LinkButton ID="lnkShowUpdateStore" runat="server" Visible="False" Text="Change Store Information"
                                                                                Style="padding-left: 100px;" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <a style="float: right;" id="PrintPage" onclick="window.print();" href="#">Print Page</a>
                                                        <br style="clear: both;" />
                                                        <hr />
                                                        <asp:Panel ID="panUpdateCustomer" runat="server" Visible="true" BorderStyle="None"
                                                            CssClass="customerInformation" DefaultButton="lnkUpdateCustomer">
                                                            <div class="sectionHeader">
                                                                Customer Information
                                                            </div>
                                                            <asp:UpdatePanel ID="UpdatePanel_Customer" runat="server" UpdateMode="Conditional">
                                                                <ContentTemplate>
                                                                    <table class="contentSection">
                                                                        <tr>
                                                                            <td align="right">
                                                                                First Name
                                                                            </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtCustomerFirstName" runat="server" MaxLength="20" Width="200px" />
                                                                            </td>
                                                                            <td align="right" style="padding-left: 35px;">
                                                                                Last Name
                                                                            </td>
                                                                            <td colspan="3">
                                                                                <asp:TextBox ID="txtCustomerLastName" runat="server" MaxLength="25" Width="200px" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="right">
                                                                                Address 1
                                                                            </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtCustomerAddress1" runat="server" MaxLength="30" Width="200px" />
                                                                            </td>
                                                                            <td align="right">
                                                                                Address 2
                                                                            </td>
                                                                            <td colspan="3">
                                                                                <asp:TextBox ID="txtCustomerAddress2" runat="server" MaxLength="30" Width="200px" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="right">
                                                                                City
                                                                            </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtCustomerCity" runat="server" MaxLength="30" Width="200px" />
                                                                            </td>
                                                                            <td align="right">
                                                                                State
                                                                            </td>
                                                                            <td>
                                                                                <asp:DropDownList ID="ddlCustomerState" runat="server">
                                                                                    <asp:ListItem Text="" Value="" />
                                                                                    <asp:ListItem Value="AL" />
                                                                                    <asp:ListItem Value="AK" />
                                                                                    <asp:ListItem Value="AZ" />
                                                                                    <asp:ListItem Value="AR" />
                                                                                    <asp:ListItem Value="CA" />
                                                                                    <asp:ListItem Value="CO" />
                                                                                    <asp:ListItem Value="CT" />
                                                                                    <asp:ListItem Value="DC" />
                                                                                    <asp:ListItem Value="DE" />
                                                                                    <asp:ListItem Value="FL" />
                                                                                    <asp:ListItem Value="GA" />
                                                                                    <asp:ListItem Value="HI" />
                                                                                    <asp:ListItem Value="ID" />
                                                                                    <asp:ListItem Value="IL" />
                                                                                    <asp:ListItem Value="IN" />
                                                                                    <asp:ListItem Value="IA" />
                                                                                    <asp:ListItem Value="KS" />
                                                                                    <asp:ListItem Value="KY" />
                                                                                    <asp:ListItem Value="LA" />
                                                                                    <asp:ListItem Value="ME" />
                                                                                    <asp:ListItem Value="MD" />
                                                                                    <asp:ListItem Value="MA" />
                                                                                    <asp:ListItem Value="MI" />
                                                                                    <asp:ListItem Value="MN" />
                                                                                    <asp:ListItem Value="MS" />
                                                                                    <asp:ListItem Value="MO" />
                                                                                    <asp:ListItem Value="MT" />
                                                                                    <asp:ListItem Value="NE" />
                                                                                    <asp:ListItem Value="NV" />
                                                                                    <asp:ListItem Value="NH" />
                                                                                    <asp:ListItem Value="NJ" />
                                                                                    <asp:ListItem Value="NM" />
                                                                                    <asp:ListItem Value="NY" />
                                                                                    <asp:ListItem Value="NC" />
                                                                                    <asp:ListItem Value="ND" />
                                                                                    <asp:ListItem Value="OH" />
                                                                                    <asp:ListItem Value="OK" />
                                                                                    <asp:ListItem Value="OR" />
                                                                                    <asp:ListItem Value="PA" />
                                                                                    <asp:ListItem Value="RI" />
                                                                                    <asp:ListItem Value="SC" />
                                                                                    <asp:ListItem Value="SD" />
                                                                                    <asp:ListItem Value="TN" />
                                                                                    <asp:ListItem Value="TX" />
                                                                                    <asp:ListItem Value="UT" />
                                                                                    <asp:ListItem Value="VT" />
                                                                                    <asp:ListItem Value="VA" />
                                                                                    <asp:ListItem Value="WA" />
                                                                                    <asp:ListItem Value="WV" />
                                                                                    <asp:ListItem Value="WI" />
                                                                                    <asp:ListItem Value="WY" />
                                                                                </asp:DropDownList>
                                                                            </td>
                                                                            <td align="right">
                                                                                Zip
                                                                            </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtCustomerZip" runat="server" Columns="6" MaxLength="5" />
                                                                                <cc1:FilteredTextBoxExtender ID="filZip" runat="server" FilterType="Numbers" TargetControlID="txtCustomerZip" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="right">
                                                                                Phone 1
                                                                            </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtCustomerPhone1" runat="server" Width="200px" />
                                                                                <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtCustomerPhone1"
                                                                                    ClearMaskOnLostFocus="false" Mask="999-999-9999" MaskType="Number" />
                                                                            </td>
                                                                            <td align="right">
                                                                                Phone 2
                                                                            </td>
                                                                            <td colspan="3">
                                                                                <asp:TextBox ID="txtCustomerPhone2" runat="server" Width="200px" MaxLength="10" />
                                                                                <cc1:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtCustomerPhone2"
                                                                                    ClearMaskOnLostFocus="false" Mask="999-999-9999" MaskType="Number" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="right">
                                                                                <a id="lnkCustomerEmail" runat="server">eMail</a>
                                                                            </td>
                                                                            <td valign="middle">
                                                                                <asp:TextBox ID="txtCustomerEmail" runat="server" Width="200px" MaxLength="50" ValidationGroup="CustomerInfo" />
                                                                                <br />
                                                                                <asp:RegularExpressionValidator ID="regEmail" runat="server" ControlToValidate="txtCustomerEmail"
                                                                                    ValidationGroup="CustomerInfo" Display="Dynamic" ErrorMessage="Email is not in valid format"
                                                                                    SetFocusOnError="True" Text="Email is not a valid email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
                                                                            </td>
                                                                            <td align="right">
                                                                                Best Time
                                                                            </td>
                                                                            <td colspan="3">
                                                                                <asp:TextBox ID="txtCustomerBestTime" runat="server" Width="400px" MaxLength="150" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:LinkButton ID="lnkUpdateCustomer" runat="server" Visible="True" Text="Update Customer Information"
                                                                                    CausesValidation="true" ValidationGroup="CustomerInfo" />
                                                                            </td>
                                                                            <td colspan="3">
                                                                                <asp:Label ID="lblCustomerUpdateResult" runat="server" ForeColor="Red" EnableViewState="false" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Button ID="Button2" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                                    CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update") %>'>
                                                                                </asp:Button>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </ContentTemplate>
                                                            </asp:UpdatePanel>
                                                        </asp:Panel>
                                                        <hr />
                                                        <asp:Panel ID="panComplaintInfo" runat="server" Visible="true" BorderStyle="None"
                                                            CssClass="complaintInformation">
                                                            <div class="sectionHeader">
                                                                Complaint Information
                                                            </div>
                                                            <table class="contentSection">
                                                                <tr>
                                                                    <td align="right">
                                                                        Order Type:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_Type" runat="server" />
                                                                    </td>
                                                                    <td align="right">
                                                                        Final Amount Spent:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_FinalAmtSpent" runat="server" />
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right">
                                                                        Date of Incident:
                                                                    </td>
                                                                    <td style="width: 150px;">
                                                                        <asp:Label ID="lblCI_IncidentDate" runat="server" />
                                                                    </td>
                                                                    <td align="right">
                                                                        Time of Incident:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_IncidentTime" runat="server" />
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right">
                                                                        Requests Contact:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_ReqContact" runat="server" />
                                                                    </td>
                                                                    <td align="right">
                                                                        Requests Contact By:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_ReqContactBy" runat="server" />
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right">
                                                                        Contacted Store:
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="lblCI_ContactStore" runat="server" />
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <br />
                                                            <div class="contentSection">
                                                                Comments:
                                                                <br />
                                                                <asp:Label ID="lblCI_Comments" CssClass="comments" runat="server" />
                                                                <br />
                                                                <br />
                                                                Complaint Category:
                                                                <asp:Literal ID="litCategory" runat="server" />
                                                            </div>
                                                        </asp:Panel>
                                                        <br style="clear: both;" />
                                                        <hr />
                                                        <asp:Panel ID="panGridCTracking" runat="server" Visible="true" BorderStyle="None"
                                                            CssClass="activityInformation">
                                                            <div class="sectionHeader">
                                                                Complaint Activity
                                                            </div>
                                                            <div class="contentSection">
                                                                <asp:UpdatePanel ID="UpdatePanel_grdCTrack" runat="server" UpdateMode="Conditional">
                                                                    <ContentTemplate>
                                                                        <table>
                                                                            <tr>
                                                                                <td>
                                                                                    <telerik:RadGrid ID="rgCHistory"  runat="server" AutoGenerateColumns="false" EnableEmbeddedSkins="false"
                                                                                        PageSize="15" Width="975px" AllowSorting="True" OrderBy="dateofupdate desc" UseHoverOverChangeColor="false"
                                                                                        OnItemCreated="rgCHistory_ItemCreated" UseDoubleClickSelect="false" ShowGoToPage="true" OnNeedDataSource="rgCHistory_NeedDataSource"
                                                                                        ShowStatusBar="true" GridLines="Horizontal" UseCustomPagerTemplate="true" DisplaySortingArrows="true"
                                                                                        DataKeyNames="id">
                                                                                        <MasterTableView Width="100%" DataKeyNames="id" CommandItemDisplay="Top">
                                                                                            <Columns>
                                                                                                <telerik:GridBoundColumn DataField="id" Visible="false" />
                                                                                                <telerik:GridDateTimeColumn DataField="dateofupdate" DataFormatString="{0:MM/dd/yyyy}"
                                                                                                    HeaderText="Report Date" />
                                                                                                <telerik:GridBoundColumn DataField="reportnumber" Visible="false" />
                                                                                                <telerik:GridBoundColumn DataField="result" HeaderText="Result" />
                                                                                                <telerik:GridBoundColumn DataField="assignedto" HeaderText="Assigned To" />
                                                                                                <telerik:GridBoundColumn DataField="assignedby" HeaderText="Assigned By" />
                                                                                                <telerik:GridBoundColumn DataField="statusid" HeaderText="Status" />
                                                                                                <telerik:GridBoundColumn DataField="comments1" HeaderText="Notes" />
                                                                                            </Columns>
                                                                                            <EditFormSettings EditFormType="Template">
                                                                                                <FormTemplate>
                                                                                                    <asp:Panel ID="pnlNew" runat="server" BackColor="#E0E0E0" BorderStyle="Groove" BorderWidth="1px"
                                                                                                        Width="99%" Visible="true" Style="padding: 5px 5px 5px 5px;">
                                                                                                        Notes<br />
                                                                                                        <asp:TextBox ID="txtNotes" runat="server" Height="60px" Width="99%" TextMode="MultiLine"
                                                                                                            ToolTip="How did you attempt to resolve this complaint? What steps did you take?" />
                                                                                                        <table>
                                                                                                            <tr>
                                                                                                                <td align="right">
                                                                                                                    Result
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:DropDownList ID="ddlResult" runat="server" ToolTip="What was the result of this action?"
                                                                                                                        Width="315px" ValidationGroup="valActivity" />
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:RequiredFieldValidator ID="reqResult" runat="server" ErrorMessage="*" Text="Result is required"
                                                                                                                        ControlToValidate="ddlResult" Display="Dynamic" InitialValue="" SetFocusOnError="true"
                                                                                                                        ValidationGroup="valActivity" />
                                                                                                                </td>
                                                                                                            </tr>
                                                                                                            <tr>
                                                                                                                <td align="right">
                                                                                                                    Status
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:DropDownList ID="ddlStatus" runat="server" ToolTip="Status of complaint" Width="315px" />
                                                                                                                </td>
                                                                                                            </tr>
                                                                                                            <tr>
                                                                                                                <td align="right">
                                                                                                                    Assign To
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:DropDownList ID="ddlAssignedTo" runat="server" Width="315px" DataTextField="Assignment"
                                                                                                                        DataValueField="LoweredAssignment" ToolTip="Leave blank if this is not a new assignment" />
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:CheckBox ID="chkIncludeStore" runat="server" Checked="false" Font-Italic="True"
                                                                                                                        Text="Include store on notifications" />
                                                                                                                </td>
                                                                                                            </tr>
                                                                                                            <tr>
                                                                                                                <td align="right">
                                                                                                                    CC Emails
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:TextBox ID="txtCopyTo" runat="server" Width="310px" ToolTip="Seperate multiple addresses with a comma, ','" />
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:CheckBox ID="chkSaveCC" runat="server" Checked="false" Font-Italic="True" Text="Save CC list for all future activity" />
                                                                                                                </td>
                                                                                                            </tr>
                                                                                                            <tr>
                                                                                                                <td />
                                                                                                                <td>
                                                                                                                    <asp:Button ID="Button1" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                                                                        CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update") %>'>
                                                                                                                    </asp:Button>
                                                                                                                    <asp:Button ID="cmdClose" runat="server" Text="Close" CausesValidation="False" CommandName="Cancel" />
                                                                                                                </td>
                                                                                                                <td>
                                                                                                                    <asp:CheckBox ID="chkIncludeFutureEmails" runat="server" Checked="false" Font-Italic="True"
                                                                                                                        Text="Email me on this and all future activity regarding this complaint" />
                                                                                                                </td>
                                                                                                            </tr>
                                                                                                        </table>
                                                                                                        <span style="color: Red; font-size: 8pt; font-family: Verdana">Please note, you cannot
                                                                                                            edit or delete an activity record after it has been added</span>
                                                                                                        <br />
                                                                                                        <asp:Label ID="lblActivityMessage" runat="server" ForeColor="Red" Font-Names="Verdana"
                                                                                                            EnableViewState="false" BackColor="Transparent" Font-Size="8pt" />
                                                                                                    </asp:Panel>
                                                                                                </FormTemplate>
                                                                                            </EditFormSettings>
                                                                                        </MasterTableView>
                                                                                    </telerik:RadGrid>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </ContentTemplate>
                                                                </asp:UpdatePanel>
                                                                <br />
                                                                <asp:Button ID="btnNewActivity" runat="server" Text="New Activity" CommandArgument="new"
                                                                    Visible="false" />
                                                                <asp:Button ID="btnAddCorr" runat="server" Text="Correspondence" Visible="false" />
                                                                <asp:UpdatePanel ID="UpdatePanel_New" runat="server" UpdateMode="Conditional">
                                                                    <ContentTemplate>
                                                                        <asp:Panel ID="pnlNew" runat="server" BackColor="#E0E0E0" BorderStyle="Groove" BorderWidth="1px"
                                                                            Width="98%" Visible="False" Style="padding: 5px 5px 5px 5px;">
                                                                            Notes<br />
                                                                            <asp:TextBox ID="txtNotes" runat="server" Height="60px" Width="99%" TextMode="MultiLine"
                                                                                ToolTip="How did you attempt to resolve this complaint? What steps did you take?" />
                                                                            <table>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Result
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:DropDownList ID="ddlResult" runat="server" ToolTip="What was the result of this action?"
                                                                                            Width="315px" ValidationGroup="valActivity" />
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:RequiredFieldValidator ID="reqResult" runat="server" ErrorMessage="*" Text="Result is required"
                                                                                            ControlToValidate="ddlResult" Display="Dynamic" InitialValue="" SetFocusOnError="true"
                                                                                            ValidationGroup="valActivity" />
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Status
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:DropDownList ID="ddlStatus" runat="server" ToolTip="Status of complaint" Width="315px" />
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Assign To
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:DropDownList ID="ddlAssignTo" runat="server" Width="315px" DataTextField="Assignment"
                                                                                            DataValueField="LoweredAssignment" ToolTip="Leave blank if this is not a new assignment" />
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:CheckBox ID="chkIncludeStore" runat="server" Checked="false" Font-Italic="True"
                                                                                            Text="Include store on notifications" />
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        CC Emails
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:TextBox ID="txtCopyTo" runat="server" Width="310px" ToolTip="Seperate multiple addresses with a comma, ','" />
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:CheckBox ID="chkSaveCC" runat="server" Checked="false" Font-Italic="True" Text="Save CC list for all future activity" />
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td />
                                                                                    <td>
                                                                                        <asp:Button ID="btnSaveActivity" runat="server" Text="Save" CausesValidation="true"
                                                                                            ValidationGroup="valActivity" />
                                                                                        <asp:Button ID="btnCancelActivity" runat="server" Text="Cancel" CausesValidation="false" />
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:CheckBox ID="chkIncludeFutureEmails" runat="server" Checked="false" Font-Italic="True"
                                                                                            Text="Email me on this and all future activity regarding this complaint" />
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                            <span style="color: Red; font-size: 8pt; font-family: Verdana">Please note, you cannot
                                                                                edit or delete an activity record after it has been added</span>
                                                                            <br />
                                                                            <asp:Label ID="lblActivityMessage" runat="server" ForeColor="Red" Font-Names="Verdana"
                                                                                EnableViewState="false" BackColor="Transparent" Font-Size="8pt" />
                                                                        </asp:Panel>
                                                                    </ContentTemplate>
                                                                    <Triggers>
                                                                        <asp:AsyncPostBackTrigger ControlID="btnNewActivity" />
                                                                    </Triggers>
                                                                </asp:UpdatePanel>
                                                                <asp:UpdatePanel ID="UpdatePanel_Corr" runat="server" UpdateMode="Conditional" Visible="false">
                                                                    <ContentTemplate>
                                                                        <asp:Panel ID="pnlCorr" runat="server" BackColor="#E0E0E0" BorderStyle="Groove" BorderWidth="1px"
                                                                            CssClass="printPnlCorr" DefaultButton="btnSubmitCorr" Width="98%" Visible="false"
                                                                            Style="padding: 5px 5px 5px 5px;">
                                                                            Correspondence<br />
                                                                            <asp:TextBox ID="txtCorr" runat="server" Width="99%" TextMode="MultiLine" Height="150px"
                                                                                CssClass="printTxtCorr" ToolTip="Insert the communication sent to the customer here" />
                                                                            <asp:Button ID="btnSubmitCorr" runat="server" Text="Save" CssClass="printBtnSubmitCorr" />
                                                                            <br />
                                                                            <asp:Label ID="lblCorrResult" runat="server" ForeColor="Red" />
                                                                        </asp:Panel>
                                                                    </ContentTemplate>
                                                                    <Triggers>
                                                                        <asp:AsyncPostBackTrigger ControlID="btnAddCorr" />
                                                                    </Triggers>
                                                                </asp:UpdatePanel>
                                                            </div>
                                                        </asp:Panel>
                                                        <div id="divCorrText">
                                                        </div>
                                                        <hr />
                                                        <asp:Panel ID="pnlHistory" runat="server" CssClass="contentSection">
                                                            <p>
                                                                <strong>OTHER COMPLAINTS WITH THE SAME PHONE NUMBER, EMAIL OR SIMILAR ADDRESS:</strong>
                                                            </p>
                                                            <asp:Literal ID="litHistory" runat="server" />
                                                        </asp:Panel>
                                                        <br />
                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                            CommandName="Cancel"></asp:Button>
                                                        <asp:HiddenField ID="hdnStoreEmail" runat="server" />
                                                        <asp:HiddenField ID="hdnDirector" runat="server" />
                                                        <asp:HiddenField ID="hdnAGM" runat="server" />
                                                        <asp:HiddenField ID="hdnCC" runat="server" />
                                                        <asp:HiddenField ID="hdnMgr" runat="server" />
                                                    </div>
                                                </asp:Panel>
                                                <asp:Panel ID="InsertPanel" runat="server">
                                                    <br />
                                                    <asp:Label ID="lblError" runat="server" ForeColor="Red" EnableViewState="false" />
                                                    <table border="0" cellpadding="1" cellspacing="0" style="text-align: left; float: left;">
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Salutation
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:DropDownList ID="ddlCustomerTitle" runat="server">
                                                                    <asp:ListItem Text="" />
                                                                    <asp:ListItem Text="Mr." Value="MR" />
                                                                    <asp:ListItem Text="Ms." Value="MS" />
                                                                    <asp:ListItem Text="Miss." Value="MISS" />
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                First Name
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomerfirstnameI" runat="server" CausesValidation="True" MaxLength="20"
                                                                    ValidationGroup="addNew" />
                                                                <asp:RequiredFieldValidator ID="valFirstName" runat="server" ControlToValidate="txtCustomerfirstnameI"
                                                                    ValidationGroup="addNew" Display="Dynamic" SetFocusOnError="true" ErrorMessage="First Name Required"
                                                                    Font-Names="Arial" Font-Size="9pt" Font-Bold="True" ToolTip="First name required" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Last Name
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomerlastnameI" runat="server" MaxLength="25" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Phone 1
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txCustomerphoneday" runat="server" MaxLength="13" ValidationGroup="addNew" />
                                                                <asp:RegularExpressionValidator ID="valPhone1" runat="server" ControlToValidate="txtCustomerphone1"
                                                                    ValidationGroup="addNew" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Phone number 1 needs to be in 555-555-5555 format"
                                                                    Font-Bold="True" Font-Names="Arial" Font-Size="9pt" ToolTip="enter phone number as 555-555-5555 or (555)555-5555"
                                                                    ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Phone 2
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomerphoneevening" runat="server" MaxLength="13" ValidationGroup="addNew" />
                                                                <asp:RegularExpressionValidator ID="valPhone2" runat="server" ControlToValidate="txtCustomerphone2"
                                                                    ValidationGroup="addNew" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Phone number 2 needs to be in 555-555-5555 format"
                                                                    ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" Font-Names="Arial"
                                                                    Font-Size="9pt" Font-Bold="True" ToolTip="enter phone number as 555-555-5555 or (555)555-5555" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Address 1
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomeraddress1I" runat="server" MaxLength="30" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Address 2
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomeraddress2I" runat="server" MaxLength="30" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                City
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomercityI" runat="server" MaxLength="30" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                State
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:DropDownList ID="ddlCustomerstateI" runat="server" Width="125px">
                                                                    <asp:ListItem Text="Not Available" Value="" />
                                                                    <asp:ListItem Value="AL">Alabama</asp:ListItem>
                                                                    <asp:ListItem Value="AK">Alaska</asp:ListItem>
                                                                    <asp:ListItem Value="AZ">Arizona</asp:ListItem>
                                                                    <asp:ListItem Value="AR">Arkansas</asp:ListItem>
                                                                    <asp:ListItem Value="CA">California</asp:ListItem>
                                                                    <asp:ListItem Value="CO">Colorado</asp:ListItem>
                                                                    <asp:ListItem Value="CT">Connecticut</asp:ListItem>
                                                                    <asp:ListItem Value="DC">D of C</asp:ListItem>
                                                                    <asp:ListItem Value="DE">Delaware</asp:ListItem>
                                                                    <asp:ListItem Value="FL">Florida</asp:ListItem>
                                                                    <asp:ListItem Value="GA">Georgia</asp:ListItem>
                                                                    <asp:ListItem Value="HI">Hawaii</asp:ListItem>
                                                                    <asp:ListItem Value="ID">Idaho</asp:ListItem>
                                                                    <asp:ListItem Value="IL">Illinois</asp:ListItem>
                                                                    <asp:ListItem Value="IN">Indiana</asp:ListItem>
                                                                    <asp:ListItem Value="IA">Iowa</asp:ListItem>
                                                                    <asp:ListItem Selected="True" Value="KS">Kansas</asp:ListItem>
                                                                    <asp:ListItem Value="KY">Kentucky</asp:ListItem>
                                                                    <asp:ListItem Value="LA">Louisiana</asp:ListItem>
                                                                    <asp:ListItem Value="ME">Maine</asp:ListItem>
                                                                    <asp:ListItem Value="MD">Maryland</asp:ListItem>
                                                                    <asp:ListItem Value="MA">Massachusetts</asp:ListItem>
                                                                    <asp:ListItem Value="MI">Michigan</asp:ListItem>
                                                                    <asp:ListItem Value="MN">Minnesota</asp:ListItem>
                                                                    <asp:ListItem Value="MS">Mississippi</asp:ListItem>
                                                                    <asp:ListItem Value="MO">Missouri</asp:ListItem>
                                                                    <asp:ListItem Value="MT">Montana</asp:ListItem>
                                                                    <asp:ListItem Value="NE">Nebraska</asp:ListItem>
                                                                    <asp:ListItem Value="NV">Nevada</asp:ListItem>
                                                                    <asp:ListItem Value="NH">New Hampshire</asp:ListItem>
                                                                    <asp:ListItem Value="NJ">New Jersey</asp:ListItem>
                                                                    <asp:ListItem Value="NM">New Mexico</asp:ListItem>
                                                                    <asp:ListItem Value="NY">New York</asp:ListItem>
                                                                    <asp:ListItem Value="NC">North Carolina</asp:ListItem>
                                                                    <asp:ListItem Value="ND">North Dakota</asp:ListItem>
                                                                    <asp:ListItem Value="OH">Ohio</asp:ListItem>
                                                                    <asp:ListItem Value="OK">Oklahoma</asp:ListItem>
                                                                    <asp:ListItem Value="OR">Oregon</asp:ListItem>
                                                                    <asp:ListItem Value="PA">Pennsylvania</asp:ListItem>
                                                                    <asp:ListItem Value="RI">Rhode Island</asp:ListItem>
                                                                    <asp:ListItem Value="SC">South Carolina</asp:ListItem>
                                                                    <asp:ListItem Value="SD">South Dakota</asp:ListItem>
                                                                    <asp:ListItem Value="TN">Tennessee</asp:ListItem>
                                                                    <asp:ListItem Value="TX">Texas</asp:ListItem>
                                                                    <asp:ListItem Value="UT">Utah</asp:ListItem>
                                                                    <asp:ListItem Value="VT">Vermont</asp:ListItem>
                                                                    <asp:ListItem Value="VA">Virginia</asp:ListItem>
                                                                    <asp:ListItem Value="WA">Washington</asp:ListItem>
                                                                    <asp:ListItem Value="WV">West Virginia</asp:ListItem>
                                                                    <asp:ListItem Value="WI">Wisconsin</asp:ListItem>
                                                                    <asp:ListItem Value="WY">Wyoming</asp:ListItem>
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Zip Code
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomerzipcode" runat="server" MaxLength="5" ValidationGroup="addNew" />
                                                                <cc1:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="txtCustomerzipcode"
                                                                    Mask="99999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError"
                                                                    MaskType="Number" AcceptNegative="None" ErrorTooltipEnabled="True" />
                                                                <asp:RegularExpressionValidator ID="regZipCode" runat="server" ControlToValidate="txtCustomerzipcode"
                                                                    ValidationGroup="addNew" SetFocusOnError="true" Display="Dynamic" ErrorMessage="Invalid Zip Code"
                                                                    ValidationExpression="\d{5}(-\d{4})?" Font-Names="Arial" Font-Size="9pt" Font-Bold="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Country
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtCustomerCountry" runat="server" Enabled="false" Text="USA" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Email
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtEmailid" runat="server" MaxLength="50" ValidationGroup="addNew" />
                                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Email is not valid"
                                                                    ValidationGroup="addNew" ControlToValidate="txtEmailid" Display="Dynamic" SetFocusOnError="true"
                                                                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Font-Names="Arial"
                                                                    Font-Size="9pt" Font-Bold="True" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Best time to call
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtBesttime" runat="server" MaxLength="150" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Incident Date
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtIncidentDate" runat="server" Width="148px" CausesValidation="True"
                                                                    ValidationGroup="addNew" />
                                                                <asp:ImageButton ID="imgStartRunCal" runat="server" ImageUrl="../Images/cal_small_icon_fill8.png"
                                                                    Width="20" Height="20" CausesValidation="False" BorderWidth="0" Style="margin: 5px 0px -5px 2px;" />
                                                                <cc1:CalendarExtender ID="caeStartRun" runat="server" TargetControlID="txtIncidentDate"
                                                                    PopupButtonID="imgStartRunCal" />
                                                                <cc1:MaskedEditExtender ID="meeStartRun" runat="server" TargetControlID="txtIncidentDate"
                                                                    Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                                                                    OnInvalidCssClass="MaskedEditError" MaskType="Date" AcceptNegative="None" ErrorTooltipEnabled="True" />
                                                                <asp:CompareValidator ID="valIncidentDate" runat="server" ControlToValidate="txtincidentdate"
                                                                    ValidationGroup="addNew" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Incident Date: Date not valid. Change format to  mm/dd/yyyy"
                                                                    Operator="DataTypeCheck" Type="Date" EnableViewState="False" Font-Names="Arial"
                                                                    Font-Size="9pt" Font-Bold="True" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                <asp:Label ID="Label2" runat="server" Font-Italic="True" Font-Size="Small" ForeColor="Gray"
                                                                    Text="(5:00)" Style="text-align: left;" />
                                                                Incident Time
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtIncidenttime" runat="server" Width="98px" />
                                                                <cc1:MaskedEditExtender ID="MaskedEditExtender4" runat="server" TargetControlID="txtIncidenttime"
                                                                    ClearTextOnInvalid="true" Mask="99:99" MessageValidatorTip="true" AutoCompleteValue="0"
                                                                    AutoComplete="true" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError"
                                                                    InputDirection="LeftToRight" MaskType="Time" AcceptNegative="None" ErrorTooltipEnabled="True" />
                                                                <asp:DropDownList ID="ddlAMPM" runat="server">
                                                                    <asp:ListItem Text="AM" />
                                                                    <asp:ListItem Text="PM" Selected="True" />
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Type of Order
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:DropDownList ID="ddlServicetype" runat="server">
                                                                    <asp:ListItem Text="" />
                                                                    <asp:ListItem Text="Carryout" />
                                                                    <asp:ListItem Text="Delivery" />
                                                                    <asp:ListItem Text="Dine-in" />
                                                                    <asp:ListItem Text="Drive-Thru" />
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Was bill adjusted?
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:CheckBox ID="chkAdjustmentindicator" runat="server" Text="(check if true)" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Final Amount Spent
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtFinalamountspent" runat="server" CausesValidation="True" ValidationGroup="addNew" />
                                                                <asp:CompareValidator ID="valFinalAmountSpent" runat="server" ControlToValidate="txtfinalamountspent"
                                                                    ValidationGroup="addNew" ErrorMessage="Final Amount Spent: Invalid dollar amount (no text)"
                                                                    Operator="DataTypeCheck" Display="Dynamic" SetFocusOnError="true" Type="Currency"
                                                                    EnableViewState="False" Font-Names="Arial" Font-Size="9pt" Font-Bold="True" ToolTip="Invalid dollar amount" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Refund Amount
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtRefundamount" runat="server" CausesValidation="True" ValidationGroup="addNew" />
                                                                <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtrefundamount"
                                                                    ValidationGroup="addNew" ErrorMessage="Refund Amount: Invalid dollar amount"
                                                                    Operator="DataTypeCheck" Display="Dynamic" SetFocusOnError="true" Type="Currency"
                                                                    EnableViewState="False" Font-Names="Arial" Font-Size="9pt" Font-Bold="True" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Contacted Restaurant?
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:CheckBox ID="chkRestaurantcontact" runat="server" Text="(check if Yes)" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Requests Contact?
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:CheckBox ID="chkFollowuprequestedflag" runat="server" Text="(check if Yes)"
                                                                    Checked="True" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Contact By
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:DropDownList ID="ddlContactMethod" runat="server" Width="165px">
                                                                    <asp:ListItem Text="" />
                                                                    <asp:ListItem Text="Phone" />
                                                                    <asp:ListItem Text="Email" />
                                                                    <asp:ListItem Text="Mail" />
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Store
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:DropDownList ID="ddlStoreNum" runat="server" Width="165px" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="middle">
                                                                Operator Id
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtOperatorid" runat="server" Enabled="False" Font-Bold="True" Font-Italic="True"
                                                                    ForeColor="Gray" MaxLength="30" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" class="tdRight" valign="top">
                                                                Customer Comments
                                                                <br />
                                                                <asp:RequiredFieldValidator ID="valComments" runat="server" BackColor="White" ControlToValidate="txtComments"
                                                                    ValidationGroup="addNew" EnableViewState="False" ErrorMessage="Comment Required"
                                                                    SetFocusOnError="True" Font-Bold="True" Font-Names="Arial" Font-Size="9pt" ToolTip="Comment required" />
                                                            </td>
                                                            <td valign="middle">
                                                                <asp:TextBox ID="txtComments" runat="server" Height="335px" TextMode="MultiLine"
                                                                    ValidationGroup="addNew" Width="500px" />
                                                                <br />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="right">
                                                                <br />
                                                                <asp:Button ID="Button1" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                    CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update") %>'>
                                                                </asp:Button>
                                                                <asp:Button ID="cmdClose" runat="server" Text="Close" CausesValidation="False" CommandName="Cancel" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                            </FormTemplate>
                                        </EditFormSettings>
                                    </MasterTableView>
                                    <ClientSettings EnableRowHoverStyle="true" />
                                    <PagerStyle Mode="NextPrevAndNumeric" />
                                    <FilterMenu EnableTheming="True">
                                        <CollapseAnimation Duration="200" Type="OutQuint" />
                                    </FilterMenu>
                                </telerik:RadGrid>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="footer">
                    <div class="outer">
                        <div class="inner">
                            <div class="content">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="UpdatePanel_FilterLabel" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <asp:Label ID="lblError" runat="server" ForeColor="Red" EnableViewState="false" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
0
Jon-Jon
Top achievements
Rank 2
answered on 06 Jul 2011, 04:02 PM
also how do you get bind the selected value to the dropdownlists "ddlStatus" & "ddlAssignedTo" in the editform of the nested "rgCHistory"? not sure how to do that either...thanks.
0
Accepted
Genti
Telerik team
answered on 07 Jul 2011, 09:29 AM
Hi Jon,

I recreated the scenario in a simple runnable solution on my side and I am attaching it so you can have it as a reference.

If the problem is still persisting, consider modifying my solution so that it shows the issue. This way we can debug it on our side and give a better suggestion.


All the best,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jon-Jon
Top achievements
Rank 2
answered on 07 Jul 2011, 05:10 PM
The only problem i have now is that the dropdownlists in the nested radgrid editformtemplate will not bind with a selected value.  When I assign the ddlstatus.selectedvalue = session("status").tostring() it has the correct value.  So when the rgCHistory_ItemCreated fires the editformtemplate doesn't come up.  It doesn't show anything.  When I comment out the line above it fires fine and displays the editformtemplate with the dropdownlists but without the correct selectedvalue.  I know the code is in an earlier post in the thread but felt I should post this again.  If I should post this as a new thread let me know. Thanks again.

Protected Sub rgCHistory_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgCHistory.ItemCreated
 
    If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
        If e.Item.OwnerTableView.IsItemInserted Then
            Dim editForm As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
            Dim ddlstatus As DropDownList = TryCast(editForm.FindControl("ddlstatus"), DropDownList)
            Dim ddlResult As DropDownList = TryCast(editForm.FindControl("ddlResult"), DropDownList)
            If ddlstatus.Items.Count = 0 AndAlso ddlResult.Items.Count = 0 Then
                oPassThru = New dalPassthru
                _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString() & ".dbo.PRC_web_SelectComplaintOptionsStatus", _sqlCon)
                Dim sqlDT As DataTable = getDataSource_DataTable(_sqlCom)
                ddlstatus.DataSource = sqlDT.Select("OptionCategory = 'status'").CopyToDataTable
                ddlstatus.DataValueField = "OptionId"
                ddlstatus.DataTextField = "OptionItem"
                ddlstatus.DataBind()
                ddlResult.DataSource = sqlDT.Select("OptionCategory = 'result'").CopyToDataTable
                ddlResult.DataValueField = "OptionId"
                ddlResult.DataTextField = "OptionItem"
                ddlResult.DataBind()
                ddlResult.Items(0).Value = Nothing
                ddlstatus.SelectedValue = Session("status").ToString()
 
            End If
            Dim ddlAssignedTo As DropDownList = TryCast(editForm.FindControl("ddlAssignedTo"), DropDownList)
            If ddlAssignedTo.Items.Count = 0 Then
                oPassThru = New dalPassthru
                _sqlCom = New SqlCommand(oPassThru.GetServer(Profile.Business) & "." & oPassThru.GetSummaryDatabase(Profile.Business).ToString & ".dbo.PRC_web_SelectComplaintAssignments", _sqlCon)
                ddlAssignedTo.DataSource = getDataSource_DataTable(_sqlCom)
                ddlAssignedTo.DataBind()
            End If
            Dim lblAssignedTo As String
            lblAssignedTo = Session("assignedto").ToString()
            ddlAssignedTo.SelectedValue = lblAssignedTo.ToString()
        End If
    End If
 
End Sub
0
Genti
Telerik team
answered on 08 Jul 2011, 11:25 AM
Hello Jon-Jon,

I suppose ItemCreatedEvent fires before Viewstate is completely loaded. That is why you might have some issues when the grid rebinds.
Can you try to do the same operation in the ItemDataBound event?

Let me know if this helps.

Regards,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Jon-Jon
Top achievements
Rank 2
Answers by
Genti
Telerik team
Jon-Jon
Top achievements
Rank 2
Share this question
or