How do I nest a datalist inside a gridview column? ASP.NET 2005

I have a working gridview.
I added this to the aspx fpage or a datalist1 control:
       <asp:TemplateField>
                    <ItemTemplate>
                        <asp:DataList ID="DataList1" runat="server" Style="z-index: 101; left: 0px; position: absolute;top: 0px">
                        </asp:DataList>
                    </ItemTemplate>
                    <ItemStyle Width="500px" />
                </asp:TemplateField>

But now I'm stuck on how to get it to work right.  My gridview column 1 displays RecordIDs.  In column 2, I want a datalist that will do a "Select Name, Address from DBO.Workshops Where RecordID = <the recordID in Gridview column One>

Any help would be greatly appreciated!
arthurh88Asked:
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.

anvCommented:
On rowdatabound of gridview, you need to find the datalist and based on the record id fetch the records and bind the results with the datalist.

let me know if further assitance is needed
0
arthurh88Author Commented:
im not sure the code to do that.  can you please post an example of code ?  I can fetch the record ID from the gridview just fine, but how do I tell the nested datalist?
0
anvCommented:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
       if (e.Row.RowType == DataControlRowType.DataRow)
        {
           DataList oDataList = (DataList)e.Row.FindControl"'Datalist1");
           oDataList1.DataSource = DataSet1; //or any other data source
           oDataList1.DataBind();
        }
    }

check this if this helps.
0
Munawar HussainPrincipal Software EngineerCommented:
hi,

here is same thing done.
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23020618.html

working code is also attached..
only one thing you need to change is DataList repeat property to vertical instead of horizontal

if you have any question let me know.
thanks
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
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
.NET Programming

From novice to tech pro — start learning today.