Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem getting DataRowView.DataItem when editing a DataGrid row

Reply
Thread Tools

Problem getting DataRowView.DataItem when editing a DataGrid row

 
 
Henri
Guest
Posts: n/a
 
      08-03-2004
Hi,

I'm using a DataGrid with ViewState disabled, so I rebind data after each
postback from the page's Sub OnLoad.
Inside one of the DataGrid column, there is a custom LinkButton to trigger a
Click event.
When this button is clicked, it displays a form (outside the datagrid) so
that the row can be edited.
The code is:

Sub row_Edit(sender As Object, e As EventArgs)
Dim link As LinkButton = CType(sender, LinkButton)
Dim row As DataGridItem = CType(link.NamingContainer, DataGridItem)
Dim view As DataRowView = CType(row.DataItem, DataRowView)

.....

End Sub

The problem is that row.DataItem is Nothing...
Why ?
As data is rebinded inside the page's OnLoad, and the linkbutton event is
triggered after, DataItem should be set...

Thanks for your help



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to stop editing another row in a Gridview, ReorderList etc when another row is already being edited Andrew Jocelyn ASP .Net 2 04-27-2009 02:01 AM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
Editing a row in a datagrid =?Utf-8?B?bWFyZWFs?= ASP .Net 1 05-02-2005 11:32 PM
Row / Column gets much bigger when editing a row in grid Bazza Formez ASP .Net 4 12-09-2004 11:03 PM
Multi-row Editing in the ASP.NET DataGrid Alex ASP .Net 1 10-06-2003 03:39 AM



Advertisments