Debug it. Set a breakpoint and see what returns null.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"AlecL" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I am trying to load control as a record is being updated in a backend
> database. The codes reads like this:
>
> Dim ds As DataSet
> CType(Page.FindControl("ddlStatus"),
> DropDownList).SelectedValue = _status
> Dim sql As String = "select * from _loanApp where status=" &
> _status
> ds =
> SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings("DSN"), _
> CommandType.Text, sql)
>
> CType(Page.FindControl("dgList"), DataGrid).DataSource = ds
> CType(Page.FindControl("dgList"), DataGrid).DataBind()
>
> but it is giving me this error.
>
> System.NullReferenceException: Object reference not set to an instance
> of an object.
>
> The stack trace reads:
>
> [NullReferenceException: Object reference not set to an instance of an
> object.]
>
> Any help is appreciated.
>