This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Front Page > February 2004 > Can someone plez help
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Can someone plez help
|
|
|
| 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!
| |
| MD Websunlimited 2004-02-26, 8:29 am |
| Hi Bilal,
What is the function call ?
--
Mike -- FrontPage MVP '09 - '02
http://www.websunlimited.com
"Bilal" <bsmalik@apparelco.com> wrote in message news:C9CB7BAC-423D-4BB4-843C-84CD628E1498@microsoft.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!
| |
| Kevin Spencer 2004-02-26, 9:28 am |
| Did you declare the "ddlColors" field in your Class definition?
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Bilal" <bsmalik@apparelco.com> wrote in message
news:C9CB7BAC-423D-4BB4-843C-84CD628E1498@microsoft.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!
| |
| Bilal 2004-02-28, 10:29 am |
| Dear Kevin,
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.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
----------------------------------------------------
I will be grateful.
----- Kevin Spencer wrote: -----
Did you declare the "ddlColors" field in your Class definition?
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Bilal" <bsmalik@apparelco.com> wrote in message
news:C9CB7BAC-423D-4BB4-843C-84CD628E1498@microsoft.com...
> hi all,
have a button and when i click the form posts back.[color=darkred]
> 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
> --------------------------------------------------------------------------
--------------------[color=darkred]
| |
| Bilal 2004-02-28, 10:29 am |
| hey mike,
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.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
----------------------------------------------------
I will be grateful
----- MD Websunlimited wrote: -----
Hi Bilal,
What is the function call ?
--
Mike -- FrontPage MVP '09 - '02
http://www.websunlimited.com
"Bilal" <bsmalik@apparelco.com> wrote in message news:C9CB7BAC-423D-4BB4-843C-84CD628E1498@microsoft.com...[color=darkred]
> hi all,
> 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
> ----------------------------------------------------------------------------------------------
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|