Passing data from a User Control to a User Control


I was playing around with web user controls and had created two controls, a search.ascx containing a text field control and a button as well as a results.ascx containing a datagrid.

The search.ascx used the submitted text to query a database and return a dataset passing the dataset to the result.ascx via a public property. All worked fine except being able to bind the datagrid to the dataset in the result.ascx control. When it came to binding I would get the 'object not set to an instance.' error.

Can anyone explain how I would bind the datagrid in the scenario, both search.ascx and result.ascx where on the same aspx page and decaled correctly and for all intense and purposes everything else was work except when it came to setting the datagrids source to the dataset?

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello UberFreak,

I had pretty much the same situation - communicating between user controls.  Please refer to the following PAQ:

http://Q_21445892.html much as I hate just pasting links, I think you will find this one very useful.

...hope that helps.
Sorry, try that:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Let me know if you have any further questions...
Were you able to solve your problem with that link UberFreak?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.