Hello,
I'm new to ASP.NET and ran into this problem which is driving me nuts. I have a datagrid which is bound with a dataset. I wan't the user to be able to change the column Aantal.
When the OnUpdateCommand is fired I really have trouble to retrieve the new filled in value. Everytime it's returning the old value. This is my code:
**********
Public Sub Grid_Update(Sender as Object, e As DatagridCommandEventArgs)
Trace.Write("Event Notification", "Grid_Update Fired"
Dim MyDS as Dataset = LoadMyDS
Dim newAantal As String
Dim row As Integer = CInt(e.Item.ItemIndex)
Trace.Write("Status Notification", "Row = " & row)
newAantal = CType(e.Item.FindControl("Hoeveelheid"
, TextBox).Text
Trace.write("Status Notification", "newAantal = " & newAantal)
dgBestellijst.EditItemIndex = -1
MyDS.Tables(0).Rows(row).Item("Aantal"
= newAantal
dgBestellijst.DataSource = MyDS
dgBestellijst.EditItemIndex = -1
dgBestellijst.DataBind()
session("MyDS"
= MyDS
Trace.Write("Status Notification", "session(MyDS) = MyDS"
End Sub
************
The problem is not a cached version or something with Postback, because when I change the line:
MyDS.Tables(0).Rows(row).Item("Aantal"
= newAantal
with
MyDS.Tables(0).Rows(row).Item("Aantal"
= 3
everything is updated as expected.
The problem is that
newAantal = CType(e.Item.FindControl("Hoeveelheid"
, TextBox).Text
doesn't give the new edited value, but the old one.
My HTML lines for this piece are:
**********
<asp:TemplateColumn HeaderText="Aantal">
<ItemTemplate>
<asp:Label runat="server" text='<%# DataBinder.Eval(Container, "DataItem.Aantal"
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="Hoeveelheid" runat="server" Width="20" Text='<%# DataBinder.Eval(Container, "DataItem.Aantal"
%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
************
Someone please help me, I'm desperate!!!
Thanks in advance,
Gert
Gert
I'm new to ASP.NET and ran into this problem which is driving me nuts. I have a datagrid which is bound with a dataset. I wan't the user to be able to change the column Aantal.
When the OnUpdateCommand is fired I really have trouble to retrieve the new filled in value. Everytime it's returning the old value. This is my code:
**********
Public Sub Grid_Update(Sender as Object, e As DatagridCommandEventArgs)
Trace.Write("Event Notification", "Grid_Update Fired"
Dim MyDS as Dataset = LoadMyDS
Dim newAantal As String
Dim row As Integer = CInt(e.Item.ItemIndex)
Trace.Write("Status Notification", "Row = " & row)
newAantal = CType(e.Item.FindControl("Hoeveelheid"
Trace.write("Status Notification", "newAantal = " & newAantal)
dgBestellijst.EditItemIndex = -1
MyDS.Tables(0).Rows(row).Item("Aantal"
dgBestellijst.DataSource = MyDS
dgBestellijst.EditItemIndex = -1
dgBestellijst.DataBind()
session("MyDS"
Trace.Write("Status Notification", "session(MyDS) = MyDS"
End Sub
************
The problem is not a cached version or something with Postback, because when I change the line:
MyDS.Tables(0).Rows(row).Item("Aantal"
with
MyDS.Tables(0).Rows(row).Item("Aantal"
everything is updated as expected.
The problem is that
newAantal = CType(e.Item.FindControl("Hoeveelheid"
doesn't give the new edited value, but the old one.
My HTML lines for this piece are:
**********
<asp:TemplateColumn HeaderText="Aantal">
<ItemTemplate>
<asp:Label runat="server" text='<%# DataBinder.Eval(Container, "DataItem.Aantal"
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="Hoeveelheid" runat="server" Width="20" Text='<%# DataBinder.Eval(Container, "DataItem.Aantal"
</EditItemTemplate>
</asp:TemplateColumn>
************
Someone please help me, I'm desperate!!!
Thanks in advance,
Gert
Gert