Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 29th, 2007, 05:35 PM
Friend of Wrox
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sometimes ButtonControl is recognisedsometimes not

I have button control in aspx page which is in formView. On page load sometimes it recognises btn Control, sometimes not. Please help took 1 day not of any success here is the code

My aspx button control is like this <asp:button ID="btnAdd" runat="server" Text="Add" commandName="insert" CausesValidation="false" OnClick="btnInsert_Click"

Page Load:

 PPdataFlag = objSrchDlt.displaySrchFavList(ppID, userID, count)

                               If PPdataFlag = "No" Then

                    myBtn = CType(frmView.FindControl("btnAdd"), Button) 'it gives Nothing here
                    myBtn.Text = "Add" 'it complains here object reference required
                    Dim myLabel As Label
                    myLabel = CType(frmView.FindControl("lblList"), Label)
                    myLabel.Text = "No"
                    If records > 1 Then
                        Call GetSearchUsersPPID()
                        Call SetPreviousNextButtons(hdnQueryString.Value)


                        'disable button if the records found in favList Table are one
                        Dim preBtn As Button
                        preBtn = CType(frmView.FindControl("btnPrev"), Button)
                        Dim nexBtn As Button
                        nexBtn = CType(frmView.FindControl("btnNext"), Button)
                        preBtn.Enabled = False
                        nexBtn.Enabled = False

                    End If

                End If

Old August 31st, 2007, 08:52 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Is this code throwing an error? What and where is it?


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.