I have a Grid that is grouped. When I update the database based on the group I get the foolwoing error:
"Unable to cast object of type 'Telerik.Web.UI.GridGroupFooterItem' to type 'Telerik.Web.UI.GridDataItem'. "
The database is updated even though the error is thrown.
Here is my code.
As always any help much appreciated.
"Unable to cast object of type 'Telerik.Web.UI.GridGroupFooterItem' to type 'Telerik.Web.UI.GridDataItem'. "
The database is updated even though the error is thrown.
Here is my code.
Private
Sub
btn_ApproveAll_Click(sender
As
Object
, e
As
EventArgs)
Dim
item
As
GridGroupHeaderItem =
DirectCast
(rgd_ProjectPlanTasksApprove.MasterTableView.GetItems(GridItemType.GroupHeader)(0), GridGroupHeaderItem)
For
Each
groupHeader
As
GridGroupHeaderItem
In
rgd_ProjectPlanTasksApprove.MasterTableView.GetItems(GridItemType.GroupHeader)
Dim
children
As
GridItem() = groupHeader.GetChildItems()
For
Each
child
As
GridDataItem
In
children
Dim
IDTaskUpdates
As
String
= child(
"IDTaskUpdates"
).Text
Dim
sql
As
String
Dim
strConnString
As
[
String
] = System.Configuration.ConfigurationManager.ConnectionStrings(
"SharePoint_ConnectionString"
).ConnectionString()
sql =
"UPDATE Task_Updates SET TaskUpdateApproved = 1, ApprovedDate = @ApprovedDate, ModifiedDate = @ModifiedDate WHERE IDTaskUpdates = @IDTaskUpdates"
Dim
cn
As
New
SqlConnection(strConnString)
Dim
cmd
As
New
SqlCommand(sql, cn)
cmd.Parameters.Add(
"@IDTaskUpdates"
, SqlDbType.Int).Value = IDTaskUpdates
cmd.Parameters.Add(
"@ApprovedDate"
, SqlDbType.DateTime).Value =
Date
.Now
cmd.Parameters.Add(
"@ModifiedDate"
, SqlDbType.DateTime).Value =
Date
.Now
cmd.Parameters.Add(
"@IDModifiedUser"
, SqlDbType.NVarChar, 36).Value = Session(
"ActiveDirID"
)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
Next
Next
End
Sub
As always any help much appreciated.