Another DGrid question...
I can not access the values of a cell in a datagrid unless
I make them visible. I do not want these fields
displayed. I only want to use the values to run a stored
procedure off of. I access them right now using the
item.cell().control method.
Here's the code:
Dim intTrxid As Integer
Dim rda As RadioButtonList
Dim vrda As String
Dim txtrem As TextBox
Dim remarks As String
Dim icn As Integer
Dim newicn As Integer
Dim datcurrent As Date
Dim FY As String
Dim newyear As Date
Dim strnewicn As String
Dim txtimptype As TextBox
Dim imptype As String
Dim txtuns As TextBox
Dim uns As String
Dim GPCcontrolno As String
Dim imp As String
'get value of unitid to find icn#
Dim txtunit As TextBox
Dim strUnit As String
Dim intunit As Integer
txtunit = e.Item.Cells(8).Controls(0)
strunit = txtunit.Text
lblUnitid.Text = strUnit
intunit = CType(strUnit, Integer)
'intUnit = 1
SqlSelectCommand5.Parameters("@unitid").Value =
intUnit
SqlDataAdapter5.Fill(DsICN1)
lblControlNo.DataBind()
datcurrent = Date.Now.ToString("d")
newyear = DateAdd(DateInterval.Year, 1, datcurrent)
FY = DatePart(DateInterval.Year, newyear)
icn = CType(lblControlNo.Text, Integer)
newicn = icn + 1
strnewicn = CStr(newicn)
lblnewicn.Text = newicn
intTrxid = dgApproval.DataKeys(e.Item.ItemIndex)
rda = e.Item.FindControl("rdApproval")
vrda = rda.SelectedItem.Value
txtrem = e.Item.FindControl("txtccmremarks")
remarks = txtrem.Text
txtimptype = e.Item.Cells(9).Controls(0)
imptype = txtimptype.Text
txtuns = e.Item.Cells(10).Controls(0)
uns = txtuns.Text
imp = Left(txtimptype.Text, 1)
GPCcontrolno = uns & FY & imp & strnewicn
If vrda = "A" Then
SqlUpdateCommand2.Parameters("@icn").Value =
GPCcontrolno
SqlUpdateCommand2.Parameters("@ta").Value = 1
SqlUpdateCommand2.Parameters("@td").Value = 0
Else
If vrda = "D" Then
SqlUpdateCommand2.Parameters("@icn").Value
= "0"
SqlUpdateCommand2.Parameters("@ta").Value
= 0
SqlUpdateCommand2.Parameters("@td").Value
= 1
End If
End If
SqlUpdateCommand2.Parameters("@remarks").Value =
remarks
SqlUpdateCommand2.Parameters("@tid").Value =
intTrxid
SqlConnection1.Open()
SqlUpdateCommand2.ExecuteNonQuery()
dgApproval.EditItemIndex = -1
BindApproval()
dgdetails.Visible = False
SqlInsertCommand1.Parameters("@unitid").Value =
intunit
SqlInsertCommand1.Parameters("@FY").Value = FY
SqlInsertCommand1.Parameters("@newicn").Value =
newicn
SqlInsertCommand1.ExecuteNonQuery()
SqlConnection1.Close()
End Sub
Thanks in advance...
Derek M