Dear Team
i tried almost all the ways which i could find on internet but still unable to get the updated values from bound grid column.
plz check out my code lines.
aspx coding
vb Code
if any body can help me regarding this .
i tried almost all the ways which i could find on internet but still unable to get the updated values from bound grid column.
plz check out my code lines.
aspx coding
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmViewUnitMaster.aspx.vb" Inherits="iTourism.WebForm1" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
>
<
table
style
=
"width:100%;"
>
<
tr
>
<
td
>
</
td
>
<
td
>
<
asp:Button
ID
=
"btnAdd"
runat
=
"server"
Text
=
"Add"
Width
=
"69px"
/>
<
asp:Label
ID
=
"lblMessage"
runat
=
"server"
Text
=
"Label"
></
asp:Label
>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
>
<
td
>
</
td
>
<
td
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"UMGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"UMGrid"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"UMGrid"
runat
=
"server"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
AllowFilteringByColumn
=
"True"
AllowSorting
=
"True"
AutoGenerateEditColumn
=
"True"
AllowPaging
=
"True"
Width
=
"60%"
ViewStateMode
=
"Enabled"
CellPadding
=
"10"
CellSpacing
=
"10"
onupdatecommand
=
"UMGrid_UpdateCommand"
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
/>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
</
ClientSettings
>
<
MasterTableView
EditMode
=
"EditForms"
DataKeyNames
=
"UnitCode"
>
<
Columns
>
<
telerik:GridBoundColumn
DefaultInsertValue
=
""
UniqueName
=
"UnitCode"
HeaderText
=
"UnitCode"
DataField
=
"UnitCode"
ReadOnly
=
"True"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DefaultInsertValue
=
""
UniqueName
=
"UnitDesc"
HeaderText
=
"Unit Description"
DataField
=
"Description"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"AutoGenerated"
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
form
>
</
body
>
</
html
>
vb Code
Imports
System
Imports
System.Data
Imports
Telerik.Web.UI
Imports
System.Data.SqlClient
Public
Class
WebForm1
Inherits
System.Web.UI.Page
Dim
objclsUnitMaster
As
New
clsUnitMaster
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
UMGrid.AutoGenerateDeleteColumn =
True
UMGrid.AutoGenerateEditColumn =
True
UMGrid.DataSource = (objclsUnitMaster.GetUnitCodeList).Tables(
"UnitMaster"
)
UMGrid.DataBind()
End
Sub
Protected
Sub
btnAdd_Click(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
btnAdd.Click
Response.Redirect(
"frmUnitMaster.aspx"
)
End
Sub
Private
Sub
UMGrid_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
UMGrid.ItemCommand
If
(e.CommandName = RadGrid.UpdateCommandName)
Then
Dim
editedItem
As
GridEditableItem =
CType
(e.Item, GridEditableItem)
Dim
newValues
As
New
Hashtable
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
'not getting the updated value
lblMessage.Text = newValues(
"Description"
).ToString
End
If
End
Sub
Private
Sub
UMGrid_NeedDataSource(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
UMGrid.NeedDataSource
UMGrid.DataSource = (objclsUnitMaster.GetUnitCodeList).Tables(
"UnitMaster"
)
UMGrid.DataBind()
End
Sub
Public
Sub
UMGrid_UpdateCommand(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
UMGrid.UpdateCommand
' Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
'Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)
Dim
_UnitCode
As
Integer
= 0
Dim
_Description
As
String
=
""
Dim
_Result
As
Long
= 0
Dim
_item
As
GridEditableItem
_item = e.Item
Try
_UnitCode = Convert.ToInt32(
DirectCast
(_item(
"UnitCode"
).Controls(0), TextBox).Text)
'Unable to Get Updated Value using this also
_Description =
DirectCast
(_item(
"Description"
).Controls(0), TextBox).Text
_Result = objclsUnitMaster.UpdateUnitByCode(_UnitCode, _Description)
If
_Result = 0
Then
lblMessage.Text =
"Record Saved Successfully"
Else
lblMessage.Text =
"Error While Saving Record"
&
" - "
& _Result
End
If
'UMGrid.Rebind()
Catch
ex
As
Exception
lblMessage.Text = ex.Message
End
Try
End
Sub
End
Class
if any body can help me regarding this .