Saturday, March 24, 2012

Web DataGrid text box doesnt post back (or something else wrong)

I try to use EditCommandColumn of Datagrid control to update a record.
EditCommand works and Update and Cancel button appear. Then a modify
text in one of appeared text boxes. There is a part of my UpdateCommand
code:

Private Sub DataGrid1_UpdateCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) _
Handles DataGrid1.UpdateCommand
Dim txtKeyID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox)
Dim txtCube As TextBox = CType(e.Item.Cells(2).Controls(0), TextBox)
Me.Label1.Text = txtCube.Text

Label control is just for troubleshooting. After I click Update button
Label receives old value, not the one that I just typed in. I try to
force Textbox to post back setting AutoPostBack to true as
txtCube.AutoPostBox = true with no result.

Please help.

*** Sent via Developersdex http://www.developersdex.com ***----------------
THIS POST IS FURTHER PROOF
----------------

<asp:Unpredictable Rubbish="true"/
HtmlControls
UserControls
WebControls

are all:

- overcomplicated
- unpredictable
- counter-productive
- inefficient

they cause many more problems than they solve
and it is strongly recommended you avoid them

furthermore it is a farce that ASPX pages do not allow
you to create methods and classes with <%%> script blocks
which are the best way to handle html literals in
presentation logic

----------------
(END)
----------------

0 comments:

Post a Comment