Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   webcontrol throws error (http://www.velocityreviews.com/forums/t776906-webcontrol-throws-error.html)

Abraham Andres Luna 09-27-2005 03:30 PM

webcontrol throws error
 
i have a cs file in my app_code directory with the following code:

using System;
using System.Web.UI.WebControls;

namespace RDK.WebControls
{
public class DepositTypDropDown : DropDownList
{
protected override void OnInit(EventArgs E)
{
base.OnInit(E);
this.Items.Add(new ListItem("Nonrefundable", "NR"));
this.Items.Add(new ListItem("Refundable", "RE"));
this.Items.Add(new ListItem("Option to Purchase", "OP"));
}
public static string GetText(string strValue)
{
DepositTypDropDown ddl = new DepositTypDropDown();
return ddl.Items.FindByValue(strValue).Text; //this line throws the
error
}
}
}


when i try to call the gettext function using:

lblDepositTyp.Text =
DepositTypDropDown.GetText(drQuote["DepositTypId"].ToString());

i get this error:

Object reference not set to an instance of an object.

is there another method i have to call after creating a new instance to get
the list items to be there?




All times are GMT. The time now is 04:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57