score:0
Accepted answer
you can try like this, peform a check before giving a datasource
var ddleligibility = ((dropdownlist)(fvsubscriber.findcontrol("ddleligibility")));
if(ddleligibility!=null)
{
ddleligibility.datasource = program;
ddleligibility.databind();
}
else
{
statusmesage.innerhtml = "it is null";
}
Source: stackoverflow.com
Related Query
- Null Reference Exception when attempting to bind dropdownlist inside formview
- Foreign Key Reference Already Has Value Exception Linq to SQL When Assigning Null
- Null reference exception in my LINQ to XML code
- Null reference Exception when trying to parse XML to object List using LINQ to XML
- Null Dapper.net query still returning Null Reference Exception with FirstOrDefault()
- null reference exception with linq .where clause
- Strange null reference exception in LINQ query with EF
- Null reference exception being thrown in EF LINQ query if-clause
- Null Reference Exception in a Dynamic LINQ Expression
- Linq to SharePoint throwing null reference exception
- Avoiding SingleOrDefault null reference exception
- LINQ query null exception when Where returns 0 rows
- LINQ to Entities - Multiple Joins - Null Reference Exception on 'Select'
- "Object reference not set to an instance of an object" even when I checked null
- I got a null reference exception on a Linq To SQL data context and I don't even really know where to start
- LINQ Left join on nullable column giving null reference exception
- Bizarre Object Null Reference Exception
- Null reference when sumarizing totals from two joined tables
- Null reference exception while using Count
- I am getting null data grid, when i bind with datatable in wpf application
- EF core 2.1 Upgrade Null reference exception even after checking for not null
- Null reference exception in Linq
- Getting null reference Exception while parsing XML through LINQ
- Generate Linq dynamically but throw exception when string[] is null
- How to overcome null exception when using Linq Count to sort a stringlist?
- Linq List.Select throws null reference exception but List.First doesn't
- Null Reference error when using any operator other than == in linq
- Exception when changing data source to SQL
- Getting null reference error in linq expression when trying to join more than 2 tables using defaultifempty method
- String comparison throws null reference exception
More Query from same tag
- GetHashCode returns different Values
- Convert List<IDictionary<string, string>> to strongly typed list in C#
- how to do a distinct on List(Of Integer())?
- Parsing XML and cast elements to a typed collection using LINQ, C#
- converting query to list (not working) asp.net mvc
- Linq to Entities, Take(3) from Joined table
- LINQ get global index
- Sorting date in string format with possible invalid/null values
- Ways to use relationship between database tables w/o using SQLite-Net Extensions
- Parsing through an XML file using a randomly generated integer
- Populate Excel with data from LINQ to SQL query
- Sorting array of structs on multiple elements in c#
- iterating over columns in a list of tuples with Linq
- Entity Framework linq master detail projection into custom classes
- How to get field as result of LINQ
- OrderByDescending(o => o.X).OrderBy(o => o.Y) does not work properly
- linq query and use result to set property
- MySQl Entity Framework C# Foreign Key Data Load Delay Error
- LINQ LEFT JOIN not working on NULL values
- C# - Displaying files in DataGridView after selecting it from FolderBrowserDialog
- Linq SELECT with ExecuteQuery
- linq question: querying nested collections
- Sort object by property in JObject
- LINQ Query, Return Max Value with Where Clause
- How add missing sequence in a list based on month and year?
- Spliting up long linq queries for improved maintainability
- Best way to check if value exists for a key in ILookup<string, string> using linq
- How can I return different DataTypes in lambda expression?
- query convert from sql to linq
- Finding if all properties within a class are the same