Can I put a Grid view in a DataList?

Hello Experts!

I have a DataList that gets data from an Object data source.

  Also within the Data List I want to display a grid which also has a seperate object data source.

 The Data Key of the Datalist's Object Data source has a value that I will use as a FilterExpression for the Grids Object Data Source.

 Using the DataLists 'OnItemDataBound' event handler I get the DataKey of the current record and use it as a filter for the  grids object data source and DataBind the Grids Object data source.  

I got the Grid to display for the First Data list Item Correctly.  However, It is repeated for the whole list and does not display the correct coresponding data key for each row.  

I put a break point  in the 'OnItemDataBound'  event handler and the Correct Key is being filtered and Databound.
However it is repeating the first grid and not updating the grid.

Any Ideas?

Thanks




DataSource  Within the the objectdata source I have a datakey.
nowmbieAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

eguilhermeCommented:
you have 1 gridview inside the datalist correct ?

and this gridview objectdatasource is inside the itemtemplate of the datalist or outside ?

if its outside, then thats why they all repeat.. since they are binding to all gridviews that gets generated..

try addin the objectdatasource of the grdiview inside the datalist itemtemplate
0

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
nowmbieAuthor Commented:
Great, Then How do I access the ObjectDataSource in code behind?  


I am getting "ObjDataS does not exist in current context".

My DataList id = DL.  

Thanks !

0
nowmbieAuthor Commented:
Thanks
0
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
ASP.NET

From novice to tech pro — start learning today.