I am using WebUserControls (ascx files) for editing a rad grid in two cases (Product Items and Order detail rows)
I would appreciate if someone can give me an idea on why in the fisrt case the Public Property DataItem() contains a DataRowView object, while in the second case the Public Property DataItem() contains a DynamicClass1 type with the values of the row fields {field1 = value1, field2 = value2...} (as exaclty works in the Telerik example)
In the DataBinding event...
in the first case I am accessing the values of the edited row as: CType(editedItem.DataItem, DataRowView).Item(#) (!!)
in the second case I am accessing the values of the edited row as: editedItem.DataItem.field1 (as exaclty works in the Telerik example)
I show you some relative code:
-----------------------
first case
-----------------------
ascx.vb
Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Namespace EditFormItemDetails
Class ItemDetails
Inherits System.Web.UI.UserControl
Private _dataItem As Object = Nothing
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
InitializeComponent()
MyBase.OnInit(e)
End Sub
Private Sub InitializeComponent()
AddHandler DataBinding, AddressOf Me.ItemDetails_DataBinding
End Sub
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Public Property DataItem() As Object
Get
Return Me._dataItem
End Get
Set(ByVal value As Object)
Me._dataItem = value
End Set
End Property
ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ItemDetails.ascx.vb"
Inherits="EditFormItemDetails.ItemDetails" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
aspx
<telerik:RadGrid ID="grdItems"
....
<EditFormSettings UserControlName="ItemDetails.ascx"
EditFormType="WebUserControl">
<EditColumn ButtonType="ImageButton"/>
<PopUpSettings Width="1228px" Modal="true"/>
</EditFormSettings>
-----------------------
second case
-----------------------
ascx.vb
Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Namespace EditFormOrderDetails
Class OrderDetails
Inherits System.Web.UI.UserControl
Private _dataItem As Object = Nothing
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
InitializeComponent()
MyBase.OnInit(e)
End Sub
Private Sub InitializeComponent()
AddHandler DataBinding, AddressOf Me.OrderDetails_DataBinding
End Sub
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Public Property DataItem() As Object
Get
Return Me._dataItem
End Get
Set(ByVal value As Object)
Me._dataItem = value
End Set
End Property
ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="OrderDetails.ascx.vb"
Inherits="EditFormOrderDetails.OrderDetails" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
aspx
<telerik:RadGrid ID="grdItems"
....
<EditFormSettings UserControlName="OrderDetails.ascx"
EditFormType="WebUserControl">
<EditColumn ButtonType="ImageButton"/>
<PopUpSettings Width="800px" Modal="true"/>
</EditFormSettings>
I would appreciate if someone understands the reason of the dataitem difference.
(I am not really sure which other part of my code is relative. Please ask me to post whatever is useful.)
Thanks
I would appreciate if someone can give me an idea on why in the fisrt case the Public Property DataItem() contains a DataRowView object, while in the second case the Public Property DataItem() contains a DynamicClass1 type with the values of the row fields {field1 = value1, field2 = value2...} (as exaclty works in the Telerik example)
In the DataBinding event...
in the first case I am accessing the values of the edited row as: CType(editedItem.DataItem, DataRowView).Item(#) (!!)
in the second case I am accessing the values of the edited row as: editedItem.DataItem.field1 (as exaclty works in the Telerik example)
I show you some relative code:
-----------------------
first case
-----------------------
ascx.vb
Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Namespace EditFormItemDetails
Class ItemDetails
Inherits System.Web.UI.UserControl
Private _dataItem As Object = Nothing
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
InitializeComponent()
MyBase.OnInit(e)
End Sub
Private Sub InitializeComponent()
AddHandler DataBinding, AddressOf Me.ItemDetails_DataBinding
End Sub
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Public Property DataItem() As Object
Get
Return Me._dataItem
End Get
Set(ByVal value As Object)
Me._dataItem = value
End Set
End Property
ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ItemDetails.ascx.vb"
Inherits="EditFormItemDetails.ItemDetails" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
aspx
<telerik:RadGrid ID="grdItems"
....
<EditFormSettings UserControlName="ItemDetails.ascx"
EditFormType="WebUserControl">
<EditColumn ButtonType="ImageButton"/>
<PopUpSettings Width="1228px" Modal="true"/>
</EditFormSettings>
-----------------------
second case
-----------------------
ascx.vb
Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Namespace EditFormOrderDetails
Class OrderDetails
Inherits System.Web.UI.UserControl
Private _dataItem As Object = Nothing
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
InitializeComponent()
MyBase.OnInit(e)
End Sub
Private Sub InitializeComponent()
AddHandler DataBinding, AddressOf Me.OrderDetails_DataBinding
End Sub
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Public Property DataItem() As Object
Get
Return Me._dataItem
End Get
Set(ByVal value As Object)
Me._dataItem = value
End Set
End Property
ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="OrderDetails.ascx.vb"
Inherits="EditFormOrderDetails.OrderDetails" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
aspx
<telerik:RadGrid ID="grdItems"
....
<EditFormSettings UserControlName="OrderDetails.ascx"
EditFormType="WebUserControl">
<EditColumn ButtonType="ImageButton"/>
<PopUpSettings Width="800px" Modal="true"/>
</EditFormSettings>
I would appreciate if someone understands the reason of the dataitem difference.
(I am not really sure which other part of my code is relative. Please ask me to post whatever is useful.)
Thanks