System.NullReferenceException: Object reference not set to an instance of an object.

A

Adam Knight

Hi all,

I have the following peice of code:

Esssentially, a querystring containing a comma separated list of values is
used to populate the appropriate intSectionID property of a user control.

<% If Not(Request.QueryString("SectionID") Is Nothing) Then %>

<% arrSectionID = Split(Request.QueryString("SectionID"), ",") %>
<Company:Links ID="LevelTwo" intSectionID="<%# arrSectionID(0) %>"
Runat="Server"/>

<% End If %>

However i keep gettting the error listed in my post..

Can someone fill me in on what could be going wrong?

I have a suspicion it may be occuring when the User Controls DataBind method
is called.
The variable is visible to the parent page, but not the user control??

Suggest a way to fix?

Cheers,
Adam
 
G

Guest

Adam,
This is aspnet user group. <%# %> code is ASP. Yes a few things are still
used <% %> this is only available for backwards compatibility not new
development.
Use the page_load or Page_render events for processing the querry string
into your control.


Bad luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top