Peter,

It worked great.  Thanks.

Mark

--- Peter Brunone <[EMAIL PROTECTED]> wrote:

> Hi Mark,
> 
>    The simplest way would be to check for null (or
> Nothing in VB), like this:
> 
> ListItem testItem = 
>
drpPropertyType.Items.FindByValue(parameterProperty_Type_ID.Value.ToString());
> 
> if(testItem == null) { 
>    // do it to it
>    }
> 
> Cheers,
> 
> Peter
> 
>  From: Mark E  [EMAIL PROTECTED] 
> 
> All,
> 
> I am using the following C# code to find and select
> an item in a DDL based on an output param from a
> sproc:
> 
>
drpPropertyType.Items.FindByValue(parameterProperty_Type_ID.Value.ToString()).Selected
> = true;
> 
> But I see that some values may not be present in my
> DDL that matches the value in my output param and it
> generates an error:
> 
> System.NullReferenceException: Object reference not
> set to an instance of an object.
> 
> When I change the param value to match a value that
> exists in my DDL, the error goes away.
> 
> How can I check for the existing of the variable
> "parameterProperty_Type_ID" in my DDL before I try
> to select it? 
> 
> Thanks,
> Mark
> 
> 
> [Non-text portions of this message have been
> removed]
> 
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to