www.webdeveloper.com
Results 1 to 3 of 3

Thread: ASP.NET Form HELP

  1. #1
    Join Date
    Feb 2006
    Posts
    38

    resolved ASP.NET Form HELP

    I am creating a print page for my form and when the print button is hit it sends the information in the textboxes, and checkboxes to a plain page and and I have labels set up to display the information.

    I have an area were they check if they need an update done, something new added, or something deleted. On the page I only want one to show up on i.e. if the checked add I just want the label to say Add Requested.

    the error i am running into is it is saying"
    Var. 'Add' is used before it has been assigned a value. A null reference execption could result at run time.

    It says the same thing for change and delete. Could someone please help w/ this problem.

    Code:
    Dim Add As CheckBox
    Dim Change As CheckBox
    Dim Delete As CheckBox
    
            If Add.Checked = True Then
                Add = Page.PreviousPage.FindControl("Add")
                lblAdd.Text = "Add Requested"
            ElseIf Change.Checked = True Then
                Add = Page.PreviousPage.FindControl("Change")
                lblChange.Text = "Change Requested"
            ElseIf Delete.Checked = True Then
                Add = Page.PreviousPage.FindControl("Delete")
                lblDelete.Text = "Delete Requested"
            End If
    Last edited by the_future21; 08-02-2006 at 09:37 AM. Reason: Complete

  2. #2
    Join Date
    Aug 2006
    Posts
    6
    Before you can check wether the checkboxes Add, Change and Delete have been checked you have to assign them to the PreviousPage.FindControl

    Code:
    Dim Add As CheckBox
    Dim Change As CheckBox
    Dim Delete As CheckBox
    
    Add = Page.PreviousPage.FindControl("Add")
    Change = Page.PreviousPage.FindControl("Change")
    Delete = Page.PreviousPage.FindControl("Delete")
    If Add.Checked = True Then
         lblAdd.Text = "Add Requested"
    ElseIf Change.Checked = True Then
         lblChange.Text = "Change Requested"
    ElseIf Delete.Checked = True Then
         lblDelete.Text = "Delete Requested"
    End If

  3. #3
    Join Date
    Feb 2006
    Posts
    38
    ok makes since thank you for your help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles