I have different users in my site. On my application page (/_layout/ page) y get some information from their ActiveDirectory and I use that information to show different contents.
Then I have a SQL table that I display using SharePoint Designer datasources. After that I create an application page on which I insert the datasource as a webpart (on the code it is inserted as ). On each row of that webpart I add an extra column with an hypelink that depends on that row ({@Id}). So I need to use that webpart created on SharePointDesigner on my application page, and then filter dinamically based on the user information. Otherwise I will need to create a sitepage for each of the possible filters (but I don't find a good solution to don't reuse the webpart).

Then I thought, let's go in the code and look for that webpart that I have created. once I find it, get it and show it on my application page. I use the next code to find the webpart:

Thanks for the tip about using asp:Panel, it's much logic. The problem is when I try to add a "ListViewByQuery" it does not work with the Panel but it does with the ContentPlaceHolder.
–
pepersviewMar 19 '12 at 9:44

About the Webpart, it still does not work. I will update my post with the code that I'm using.
–
pepersviewMar 19 '12 at 9:45

You can add this web part like describes in this post. But I think that if you add a web part to an application page, you are doing something wrong ))) You can read difference between application and web part pages here.

Thanks for the link. After reading the second one I think that I was understanding good the difference between all of them, but in my case I think I should use it on that way. I will explain more detailed in the Update of my question.
–
pepersviewMar 19 '12 at 9:46

About the first link, I can not use that because I need to add the webpart dynamically, depending on the user.
–
pepersviewMar 19 '12 at 9:47