By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

DataGrid and onClick Question

P: n/a
Hi Everyone,

I have an easy question I think. I have this datagrid and it has a button
in it that deletes a field in my database. I dont want someone to
accidentally click on it and BOOM! data gone.

I used to be able on normal buttons add a Java onClick event right in the
button itself to do this:

onClick="window.alert('teste');"

Well thats all fine an dandy but DOTNET hates it when I do that to buttons
in a datagrid and pukes on me. So I thought to myself, lets set it in the
page_load event right? So I used this code:

Dim btnDelete As ImageButton =
CType(dgUserData.FindControl("Imagebutton2"), ImageButton)
btnDelete.Attributes.Add("onClick", "window.alert('teste');")

And it hates that as well. Tells me that btnDelete is not set to a
reference of an object. And yes I tried it with the NEW clause as well and
gt the same events.

Surely there is a way to add client side validation so the boobs that use
this site dont get data whacking happy without at least clicking 'OK' :-)

Lemme know if anyone has any ideas.

-Timothy
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.