473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

problem with Rowdeleting event

Hi,

Before deleting a record in a gridview, i want to check the value of a
particular field.

I do this with this code (vb.net):

Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles
GridView1.RowDeleting
Dim myval As String
myval = e.Values.Item("myfield").ToString
......
if myval..... then
e.cancel
end if

This works only when the field is not empty. If it's empty, i get the error:
""Object reference not set to an instance of an object"

Any way to avoid that error?
Thanks
Bart
Jan 31 '08 #1
0 1426

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
1
by: Bruno Piovan | last post by:
Hello, I'm having a strange problem with gridview, I have a portion of code that binds data to the gridview: gvCategories.DataSource = dt gvCategories.DataKeyNames = New String()...
1
by: keithb | last post by:
What causes a GridView RowCommand Event to intercept a RowDeleting Event? How to cure it? Thanks, Keith
0
by: ryan.wilkins | last post by:
I'm new to ASP.NET 2.0 and the gridview control so forgive the dumb question. I have a BoundField column that I can't seem to get the value from in the RowDeleting Event. <asp:BoundField...
6
by: Greg | last post by:
Hello, I have a GridView bound to a custom object. I set the DataKeyNames property along with the column DataField properties at design time, and bind the GridView to my object at run-time. In...
0
by: jobs | last post by:
Gridview with datasoure with deletecommand. Why do I need an event handler? Isn't this enough? I know this code has worked when I use a fielditemtemplate <asp:GridView ID="RouteGridView"...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
2
by: Munna | last post by:
Hi, RowDeleting->Occurs when a row's Delete button is clicked, but before the GridView control deletes the row. RowDeleted->Occurs when a row's Delete button is clicked, but after the GridView...
1
pbala
by: pbala | last post by:
While Delete a Row in Gridview using OnRowCommand this error was occured. Error: The GridView 'jobgrid' fired event RowDeleting which wasn't handled. but the record is deleted in gridview
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.