Datagrid Updatecommand problem!! Urgent

S

Serkan DIRIARIN

Hi! I have a datagrid and i want to update new values after editing
datagrid.
i am using following code;

tb = CType(e.Item.Cells(1).Controls(0), TextBox)
dv.Item(0).Item(1) = tb.Text

but when i try, i am getting original values from textbox

can anyone help?
thanks
 
L

linhardt

I'm new to this myself, but my guess is that it may be a postback
problem. Postback occurs when you click on the Update link (to reload
the HTML without the edit boxes). This occurs before your
OnUpdateCommand Event handler is called. My OnPageLoad handler should
look something like this:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
DBcon.Open()
LoadDataSetFromDBandBind2Grid()
DBcon.Close()
Else
RestoreDataSetFromViewState()
End If
End Sub

good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top