This is a migrated thread and some comments may be shown as answers.

[Solved] Accessing Changed Values in UpdateCommand Event

2 Answers 253 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh Mishra
Top achievements
Rank 1
Suresh Mishra asked on 04 Sep 2009, 03:02 PM
Hi,

I have  a drop down and a rad combo box.  While running the application, I go into edit mode, click on the drop down and change the selected value.  I then click on the "update" link next to the line.  

I get the handle on the dropdown list or rad combo box in UpdateCommand event, but when I examine the SelectedValue, it is still the same as before.  How can I access the changed value in this case?  What am I missing?

Thanks.

Suresh

Here is the code I am using:

 

<telerik:GridTemplateColumn DataField="CostCenterName" HeaderText="Adj Cost Center Name" UniqueName="CostCenterName">

 

 

<ItemTemplate>

 

<%

#DataBinder.Eval(Container.DataItem, "CostCenterName")%>

 

 

</ItemTemplate>

 

 

<ItemStyle Width="300px" />

 

 

<EditItemTemplate>

 

 

<telerik:RadComboBox DataTextField="CostCenterName"

 

 

DataValueField="CostCenterName"

 

 

OnTextChanged="RadComboBoxAdjustedCC_TextChanged"

 

 

OnItemsRequested="RadComboBoxAdjustedCC_ItemsRequested"

 

 

EnableLoadOnDemand="True"

 

 

ID="RadComboBoxAdjustedCC"

 

 

runat="server"

 

 

Height="140px"

 

 

Width="220px"

 

 

SelectedValue='<%#Bind("CostCenterName")%>'

 

 

DataSourceID="ObjectDataSourceGetCostCenters">

 

 

</telerik:RadComboBox>

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn DataField="Site" HeaderText="Site" UniqueName="Site">

 

 

<ItemTemplate>

 

<%

#DataBinder.Eval(Container.DataItem, "Site")%>

 

 

</ItemTemplate>

 

 

<EditItemTemplate>

 

 

<asp:DropDownList ID="DropDownListSite" runat="server"

 

 

SelectedValue='<%#DataBinder.Eval(Container.DataItem, "Site")%>' >

 

 

<asp:ListItem Value="C">BAH</asp:ListItem>

 

 

<asp:ListItem Value="G">Govt.</asp:ListItem>

 

 

</asp:DropDownList>

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn>

 


VB Code: 

 

Protected Sub RadGridEmpData_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridEmpData.UpdateCommand

 

 

Dim s As String

 

s =

""

 

 

Dim objDDL As DropDownList

 

objDDL =

CType(e.Item.FindControl("DropDownListSite"), DropDownList)

 

s = objDDL.SelectedValue

 

Dim objRComb As RadComboBox

 

objRComb = e.Item.FindControl(

"RadComboBoxAdjustedCC")

 

s = objRComb.SelectedValue

 

 

End Sub

 


2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 04 Sep 2009, 03:13 PM
Hello Suresh,

I suggest you review the following articles in order to find a solution for your case:
Insert/Update/Delete at database level with queries
Accessing cells and rows

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Suresh Mishra
Top achievements
Rank 1
answered on 04 Sep 2009, 08:43 PM
I was able to fix this problem by setting EnableViewState="false"  for the rad grid.

Thanks.

Suresh
Tags
Grid
Asked by
Suresh Mishra
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Suresh Mishra
Top achievements
Rank 1
Share this question
or