Riiiiiiiiiiiight. You just did.
You are a big mouth Linux know it all jive turkey Linux user. So help me
with the code in this program I am working on the job right now. I am
having a lot of trouble with this code I have been working on the job
working this inherited code for about a week now, since you claim to be
the know it all greatest thing since sliced toast -- turkey Linux user.
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim ddl As DropDownList
Dim lnb As LinkButton
Dim cbo As ProgStudios.WebControls.ComboBox
Dim tb As TextBox
Dim ib As System.Web.UI.WebControls.ImageButton
Dim i
Dim ws As New CincinnatiSAS.cbadsasws.svcCBADSAS
Dim wsCookieJar As System.Net.CookieContainer
Try
ws.Credentials = System.Net.CredentialCache.DefaultCredentials
Util.initWebServiceSessionVars(wsCookieJar, ws, Session,
Me.Context.User.Identity.Name)
If e.Item.ItemType = ListItemType.Header Then
If Me.DataGrid1.ShowFooter Then
'when showfooter is on make ADD row visible
CType(e.Item.FindControl("ibAdd"),
System.web.UI.WebControls.ImageButton).Visible = False
CType(e.Item.FindControl("ibAcceptAdd"),
System.web.UI.WebControls.ImageButton).Visible = True
CType(e.Item.FindControl("ibAcceptPlusAdd"),
System.web.UI.WebControls.ImageButton).Visible = True
CType(e.Item.FindControl("ibUndoAdd"),
System.web.UI.WebControls.ImageButton).Visible = True
CType(e.Item.FindControl("ddlBITypeAdd"),
DropDownList).Visible = True
CType(e.Item.FindControl("ddlStatusAdd"),
DropDownList).Visible = True
CType(e.Item.FindControl("tbCircuitIDAdd"),
TextBox).Visible = True
CType(e.Item.FindControl("tbBeginBillDateAdd_Control"),
eWorld.UI.MaskedTextBox).Visible = True
CType(e.Item.FindControl("tbStartDateAdd_Control"),
eWorld.UI.MaskedTextBox).Visible = True
CType(e.Item.FindControl("tbEndDateAdd_Control"),
eWorld.UI.MaskedTextBox).Visible = True
CType(e.Item.FindControl("ibBeginBillDateAdd"),
ImageButton).Visible = True
CType(e.Item.FindControl("ibStartDateAdd"),
ImageButton).Visible = True
CType(e.Item.FindControl("ibEndDateAdd"),
ImageButton).Visible = True
CType(e.Item.FindControl("lbBeginBillDateMaxAdd"),
Label).Visible = True
CType(e.Item.FindControl("lbStartDateMaxAdd"),
Label).Visible = True
CType(e.Item.FindControl("lbEndDateMaxAdd"),
Label).Visible = True
CType(e.Item.FindControl("tbOrigNPAAdd"),
TextBox).Visible = True
CType(e.Item.FindControl("tbOrigNXXAdd"),
TextBox).Visible = True
CType(e.Item.FindControl("tbTermNPAAdd"),
TextBox).Visible = True
CType(e.Item.FindControl("tbTermNXXAdd"),
TextBox).Visible = True
CType(e.Item.FindControl("tbBillItemAdd"),
TextBox).Visible = True
End If
If Me.EditMode = True And Me.EditModeGrid <> FormName Then
CType(Me.saveHeaderItem.FindControl("ibAdd"),
System.Web.UI.WebControls.ImageButton).Visible = False
End If
If CInt(Me.OrderNumber) < 0 Then
CType(Me.saveHeaderItem.FindControl("ibAdd"),
ImageButton).Visible = False
End If
Me.pnlState = e.Item.FindControl("pnlStateCRMCI")
ElseIf e.Item.ItemType = ListItemType.EditItem Then
CType(e.Item.FindControl("ddlStatusEdit"),
System.Web.UI.WebControls.DropDownList).SelectedValue =
drv("BLSTAT").ToString.TrimEnd
If drv("BLSTAT").ToString.TrimEnd = "C" Then
CType(e.Item.FindControl("tbCancelDateEdit"),
System.Web.UI.WebControls.TextBox).Text = drv("BLCNDT").ToString.TrimEnd
CType(e.Item.FindControl("tbStartDateEdit"),
System.Web.UI.WebControls.TextBox).Text = drv("BTCSDT").ToString.TrimEnd
Else
CType(e.Item.FindControl("tbBeginBillDateEdit"),
System.Web.UI.WebControls.TextBox).Text = drv("BLINDT").ToString.TrimEnd
CType(e.Item.FindControl("tbStartDateEdit"),
System.Web.UI.WebControls.TextBox).Text = drv("BTCSDT").ToString.TrimEnd
End If
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Visible = False
CType(Me.saveHeaderItem.FindControl("ibAdd"),
System.Web.UI.WebControls.ImageButton).Visible = False
' CType(e.Item.FindControl("ibEdit"),
ImageButton).Enabled = False
'System.Diagnostics.Debug.WriteLine(CType(e.Item.FindControl("ddlStatusEdit"),
System.Web.UI.WebControls.DropDownList).SelectedValue)
If Me.DataGrid1.EditItemIndex <> -1 Then
If CType(e.Item.FindControl("ddlStatusEdit"),
System.Web.UI.WebControls.DropDownList).UniqueID = "C" Then
CType(e.Item.FindControl("tbCancelDateEdit_Control"),
eWorld.UI.MaskedTextBox).Visible = True
CType(e.Item.FindControl("ibCancelDateEdit"),
ImageButton).Visible = True
End If
End If
ElseIf e.Item.ItemType = ListItemType.Item Or
e.Item.ItemType = ListItemType.AlternatingItem Then
If Me.DataGrid1.ShowFooter Then
CType(e.Item.FindControl("ibEdit"),
System.web.UI.WebControls.ImageButton).Visible = False
CType(e.Item.FindControl("ibEditPlus"),
System.web.UI.WebControls.ImageButton).Visible = False
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Visible = False
Else
If Me.DataGrid1.EditItemIndex <> -1 Then
CType(e.Item.FindControl("ibEdit"),
ImageButton).Visible = False
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Visible = False
CType(Me.saveHeaderItem.FindControl("ibAdd"),
System.Web.UI.WebControls.ImageButton).Visible = False
ElseIf CInt(Me.OrderNumber) < 0 Then
'in view only mode hide Edit buttons
CType(e.Item.FindControl("ibEdit"),
System.web.UI.WebControls.ImageButton).Visible = False
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Text = "View"
Else
CType(e.Item.FindControl("ibEdit"),
ImageButton).Visible = True
End If
If Me.EditMode = True And Me.EditModeGrid <>
FormName Then
CType(e.Item.FindControl("ibEdit"),
ImageButton).Visible = False
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Visible = False
CType(Me.saveHeaderItem.FindControl("ibAdd"),
System.Web.UI.WebControls.ImageButton).Visible = False
End If
If drv.Row.RowState = DataRowState.Added And
Me.EditMode = False Then
CType(e.Item.FindControl("ibRemove"),
System.Web.UI.WebControls.ImageButton).Visible = True
ElseIf Me.EditMode = True And Me.EditModeGrid
<> FormName Then
CType(e.Item.FindControl("ibRemove"),
System.Web.UI.WebControls.ImageButton).Visible = False
End If
''If drv.Row.RowState <> DataRowState.Added AndAlso
drv("updateCRMState") <> 1 Then
'' Dim help As String
''Else
'
CType(e.Item.FindControl("tbBeginBillDateEdit"), TextBox).Text =
Format(drv("fld_foc_date"), "00000000").Substring(0, 2) & "/" &
Format(drv("fld_foc_date"), "00000000").Substring(2, 2) & "/" &
Format(drv("fld_foc_date"), "00000000").Substring(4)
'CType(e.Item.FindControl("tbStartDateAdd"),
TextBox).Text = Me.myDateFormat(drv("BTCSDT"))
'CType(e.Item.FindControl("tbEndDateEdit"),
TextBox).Text = Me.myDateFormat(drv("BTCEDT"))
''End If
If drv("BLSTAT").ToString.TrimEnd = "C" Then
CType(e.Item.FindControl("lnbEditFeatures"),
System.web.UI.WebControls.LinkButton).Visible = False
'CType(e.Item.FindControl("ibEdit"),
ImageButton).Visible = False
End If
If drv.Row.RowState = DataRowState.Added Then
' change background color - this is an add item
For i = 1 To e.Item.Cells.Count - 1
e.Item.Cells(i).BackColor =
IIf(e.Item.ItemType = ListItemType.Item,
System.Drawing.Color.FromArgb(255, 213, 213),
System.Drawing.Color.FromArgb(255, 196, 196))
Next
Me.pnlState.Visible = True
ElseIf drv("updateCRMState") = 1 Then
' change background color
For i = 1 To e.Item.Cells.Count - 1
e.Item.Cells(i).BackColor =
IIf(e.Item.ItemType = ListItemType.Item,
System.Drawing.Color.FromArgb(255, 213, 213),
System.Drawing.Color.FromArgb(255, 196, 196))
Next
Me.pnlState.Visible = True
ElseIf drv("updateCRMState") = 2 Then
' change background color
For i = 1 To e.Item.Cells.Count - 1
e.Item.Cells(i).BackColor =
IIf(e.Item.ItemType = ListItemType.Item,
System.Drawing.Color.FromArgb(255, 255, 213),
System.Drawing.Color.FromArgb(255, 255, 178))
Next
Me.pnlState.Visible = True
ElseIf drv.Row.RowState = DataRowState.Modified Then
'' change background color - this is a changed item
'For i = 1 To e.Item.Cells.Count - 1
' e.Item.Cells(i).BackColor =
IIf(e.Item.ItemType = ListItemType.Item,
System.Drawing.Color.FromArgb(255, 255, 213),
System.Drawing.Color.FromArgb(255, 255, 178))
'Next
'Me.pnlState.Visible = True
End If
' CType(e.Item.FindControl("lbBeginBillDate"),
Label).Text = Format(drv("fld_foc_date"), "00000000").Substring(0, 2) &
"/" & Format(drv("fld_foc_date"), "00000000").Substring(2, 2) & "/" &
Format(drv("fld_foc_date"), "00000000").Substring(4)
Dim it As String = Me.myDateFormat(drv("BTCSDT"))
'CType(e.Item.FindControl("lbStartDateEdit"),
Label).Text = Me.myDateFormat(drv("BTCSDT"))
'CType(e.Item.FindControl("lbEndDateEdit"),
Label).Text = Me.myDateFormat(drv("BTCEDT"))
End If
End If
Return
Catch ex1 As Threading.ThreadAbortException
' ignore this exception
Catch ex As Exception
Util.LogException("wucEgixLegacy_Dedicated:
ataGrid1_ItemDataBound",
ex, Me.UserId, Me.OrderNumber)
Me.ErrorMessage = ex.Message
Server.Transfer("wfError.aspx?SASOpenGUID=" & Me.SASOpenGUID)
End Try
End Sub