By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,979 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,979 IT Pros & Developers. It's quick & easy.

Urgent: Please need help badly

P: n/a
hi all

I am facing a little problem. I have a form with a dropdownlist control. I have a button and when i click the form posts back
The problem is that in the on button click event i'm calling this metho
------------------
Sub cute(sender As Object, e As EventArgs
Response.Write(ddlColors.SelectedItem.text
End Su

------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception
---------------------------------------------------------------------------------------------
System.NullReferenceException: Object reference not set to an instance of an objec
---------------------------------------------------------------------------------------------

Please tell me what can i do about this and what am i doing wrong

thanks!
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi, Bilal,

Try to debug your code to see what is in fact null-reference (Nothing in
VB.NET).

Greetings
Martin
"Bilal" <bs*****@apparelco.com> wrote in message
news:09**********************************@microsof t.com...
hi all,

I am facing a little problem. I have a form with a dropdownlist control. I have a button and when i click the form posts back. The problem is that in the on button click event i'm calling this method
-------------------
Sub cute(sender As Object, e As EventArgs)
Response.Write(ddlColors.SelectedItem.text)
End Sub

-------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception: -------------------------------------------------------------------------- -------------------- System.NullReferenceException: Object reference not set to an instance of an object -------------------------------------------------------------------------- --------------------
Please tell me what can i do about this and what am i doing wrong.

thanks!

Nov 18 '05 #2

P: n/a
Kindly send the code:
so that it can be debugged.
As if there is any value in the dropdownlist and if u are calling the
function at the click of the button then it should work.
Arvind.
"Martin Dechev" <de*******@hotmail.com> wrote in message
news:e2*************@TK2MSFTNGP11.phx.gbl...
Hi, Bilal,

Try to debug your code to see what is in fact null-reference (Nothing in
VB.NET).

Greetings
Martin
"Bilal" <bs*****@apparelco.com> wrote in message
news:09**********************************@microsof t.com...
hi all,

I am facing a little problem. I have a form with a dropdownlist control.
I have a button and when i click the form posts back.
The problem is that in the on button click event i'm calling this method
-------------------
Sub cute(sender As Object, e As EventArgs)
Response.Write(ddlColors.SelectedItem.text)
End Sub

-------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception:

--------------------------------------------------------------------------
--------------------
System.NullReferenceException: Object reference not set to an instance

of an object

--------------------------------------------------------------------------
--------------------

Please tell me what can i do about this and what am i doing wrong.

thanks!


Nov 18 '05 #3

P: n/a
hey Arvind
thanks for your reply. i figured that out by moving my code where i populated the dropdownlist into the sub page_load and there it works fine. I am really a new bie at .net and am trying to move to vs.net from visual interdev

I have one another problem which i encounter when i create a new file in vs.net. I am pasting the error. Basically I have a file named ShoppingCart.aspx which when i build and browse gives the error below
Please help me
---------------------------------------------------
Server Error in '/OnLineShopping' Application
-------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'OnLineShopping.ShoppingCart'

Source Error:

Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="ShoppingCart.aspx.vb" Inherits="OnLineShopping.ShoppingCart"%
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
Line 3: <html
Source File: C:\Inetpub\wwwroot\OnLineShopping\ShoppingCart.asp x Line: 1

-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
---------------------------------------------------
----- Arvind P Rangan wrote: ----

Kindly send the code
so that it can be debugged
As if there is any value in the dropdownlist and if u are calling th
function at the click of the button then it should work
Arvind
"Martin Dechev" <de*******@hotmail.com> wrote in messag
news:e2*************@TK2MSFTNGP11.phx.gbl..
Hi, Bilal
Try to debug your code to see what is in fact null-reference (Nothing i VB.NET)
Greeting

Marti
"Bilal" <bs*****@apparelco.com> wrote in messag
news:09**********************************@microsof t.com..
hi all
I am facing a little problem. I have a form with a dropdownlist control
have a button and when i click the form posts back
The problem is that in the on button click event i'm calling this metho
------------------
Sub cute(sender As Object, e As EventArgs
Response.Write(ddlColors.SelectedItem.text
End Su
------------------ in which i'm only trying to access my dropdownlist ddlColors's selecte

value. It gives me this exception
-------------------------------------------------------------------------

-------------------
System.NullReferenceException: Object reference not set to an instanc

o an objec
-------------------------------------------------------------------------

------------------- Please tell me what can i do about this and what am i doing wrong
thanks

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.