Solved

Nested Datalists in vb.net

Posted on 2007-04-03
3
329 Views
Last Modified: 2008-02-26
Hi,
I want to put a datalist inside another datalist...like a stack - one on top of another
but I do not know if I can do this? Will it overlap my data in column list?
Does anyone know how I can do this... Here is what I am trying to do...
Thanks!

Report_03/23/2005  <- to do to Page2
Report_03/16/2005  <- to do to Page2 (this would be a beginning of my second datalist)
Report_03/09/2005  <- to do to Page1 (this would be my first datalist)  
Report_03/02/2005  <- to do to Page1
Report_02/23/2005  <- to do to Page1
Report_02/16/2005  <- to do to Page1
Report_02/09/2005  <- to do to Page1  and so one...Page1
0
Comment
Question by:avi4
3 Comments
 
LVL 4

Accepted Solution

by:
Neotk earned 500 total points
ID: 18847074
You can add a datalist inside another... but when you have to work with your nested datalist, you'll have to reference it in code as DataList and work on it. like this:

(I'll try to write in vb... but i'm from c#.. so i'll comment the code, so you'll know what to do in vb)

foreach(DataListItem item in mydatalist1.Items)
{
    //Test if the item on datalist is an item
    if(item.ItemType == item.ListItemType.Item;
    //Here i'm finding the datalist inside the item of your  datalist
    Dim DataList dataList = item.FindControl("mydatalistID") as DataList;
   
    //Now you can work on the datalist inside that item in your other datalist. Just using the reference you //just did.
  // like this
   datalist.DataSource = mysource;
   datalist.DataBind();
}

Here you can take a better looking on how to get controls inside datalist:
http://forums.asp.net/thread/1596722.aspx
http://p2p.wrox.com/topic.asp?TOPIC_ID=8523
http://www.csharphelp.com/board2/read.html?f=1&i=49377&t=49377
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now