Link to home
Start Free TrialLog in
Avatar of eusaitdept
eusaitdept

asked on

If Statement within Formview

Hi,

Looking to write a very simple if statement that would read something like this:

If fieldinformview = "New" then
  cmdAccept.Visible = True
End If

I can't currently find a function that will allow me to pull out the formview's data so that the statement will work.

Help much appreciated.
ASKER CERTIFIED SOLUTION
Avatar of strickdd
strickdd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eusaitdept
eusaitdept

ASKER

Hi - I've written that code up:

 If DirectCast(FormView1.FindControl("StatusLabel"), TextBox).Text <> "Acc" Then
            Button3.Visible = True
        Else
            Button3.Visible = False
        End If

Open in new window


However receive the following error on loading the page:

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  Source=SocManagerAdmin
  StackTrace:
       at SocManagerAdmin.WebForm4.Page_Load(Object sender, EventArgs e) in \\orthus.ucs.ed.ac.uk\eusahome\abyers1\Visual Studio 2010\Projects\SocManagerAdmin(7)\SocManagerAdmin\pages\devDetails.aspx.vb:line 7
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 

Open in new window



Haha! Fixed it, I was looking for a Label not a TextBox so I've changed the code and it's working now, thanks :)