FindControl

T

TJS

getting error on this code:

Dim ctrl As button = FindControl("btnDelete")
ctrl.Attributes.Add("onclick", "javascript:return confirm('Are you sure
you want to delete this ? ')")


error:
Object reference not set to an instance of an object.

btnDelete is a button inside another control called "ConfirmForm" but I
can't seem to find it to add the warning

What's missing ??
 
D

David Kyle

I believe that if you call the "FindControl()" method on the ConfirmForm
object you will get it to work.

Eg.

dim ctrl As button = ConfirmForm.FindControl("btnDelete");
ctrl.Attributes.Add("onclick", "javascript:return confirm('Are you sure you
want to delete this ? ')")

Cheers!

David Kyle
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top