wsyeager
Centurion
I'm trying to get an instance of a Delete button on my webform in order to display a warning msg to the user. I've done this type of thing several times for a button inside a datagrid for a user confirm to delete a particular record. this webform has no datagrid. Simply a delete button. However, the form is set up as having multiple placeholder controls depending upon which functionality is initially selected.
The following is the html within my webform:
The following info is in my code-behind:
While debugging, I get the following instance of the Delete button from within the Auto window:
- btnDelete {Text = "Delete"} System.Web.UI.WebControls.Button
As you can see, the ID of the button is availabile.
I'm getting an "Object not set to an instance of an object" on the boldfaced line of code above.
What am I doing wrong here where I can't get an instance of this object?
The following is the html within my webform:
Code:
<asp:Button id="btnDelete" Text="Delete" runat="server" class="eppbutton"/>
The following info is in my code-behind:
Visual Basic:
ElseIf Request.QueryString.Item("iManage") = 3 Then 'Delete
plcAddFile.Visible = False
plcAddFolder.Visible = False
plcDelete.Visible = True
plcEdit.Visible = False
plcPublish.Visible = False
plcCustomize.Visible = False
plcContact.Visible = False
'Set up a delete confirmation
Dim btnDeleteFilefolder As Button
btnDeleteFilefolder = DirectCast(Me.FindControl("btnDelete"), Button)
btnDeleteFilefolder.Attributes.Add("onclick", "return getdelconfirm();")
While debugging, I get the following instance of the Delete button from within the Auto window:
- btnDelete {Text = "Delete"} System.Web.UI.WebControls.Button
As you can see, the ID of the button is availabile.
I'm getting an "Object not set to an instance of an object" on the boldfaced line of code above.
What am I doing wrong here where I can't get an instance of this object?
Last edited by a moderator: