Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 February 5th, 2004, 04:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I tried playing with it. This is the HTML section:
<panel1>
    <myCatHolder />
    Continue button
</panel1>

<panel2>
    <myCatHolder2 />
    Previous + Continue button
</panel2>

<panel3>
    hand built form
    Previous + Submit button
</panel3>

On the first continue button I added:
Session("myDrpDwnCat") = drpDwnCategory.SelectedItem

When the first continue button is clicked it gives the same error:
Object reference not set to an instance of an object.

 
Old February 6th, 2004, 10:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I created a simple page this morning to see if I would get the same error message and I did. Here is the code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myDrpDwn As New DropDownList
        myDrpDwn.ID = "categoryddl"
        myDrpDwn.Items.Add("Selection 1")
        myDrpDwn.Items.Add("Selection 2")
        myDrpDwn.Items.Add("Selection 3")
        PlaceHolder1.Controls.Add(myDrpDwn)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = categoryddl.SelectedValue
End Sub

It loads fine but when the Submit button is clicked it again displays:
Object reference not set to an instance of an object.

 
Old February 6th, 2004, 11:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

For anybody following this post you must add this to the Button_Click Sub

Dim ddl As DropDownList = PlaceHolder1.FindControl("categoryddl")
Label1.Text = ddl.SelectedValue

It now works.

 
Old January 7th, 2005, 06:05 AM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

actually I have just started using asp.net and have been having this same error since long.. can u teell where have you declared this PlaceHolder1 in the html part and what is it exactly

 
Old January 10th, 2005, 10:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

The placeholder is on the web page.

PlaceHolder is a control use to reserve space for controls added by code.

Can you give more specifics about your problem?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub Form Problems mohiddin52 Access VBA 1 July 29th, 2008 04:51 PM
Problems while opening form anukagni Access 4 March 31st, 2008 05:54 AM
Form Corruption / Problems with Where Clause jeremy1048 Access 7 October 22nd, 2007 09:52 AM
Splash form problems mwphillips Beginning VB 6 1 November 19th, 2003 05:02 AM





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