.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

nested selects or so

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
Hi all, I'm stuck on a sql select problem. I write my own forum and for the main subject index page I want to display the name of each subject, and for each subject I want to display the latest thread: CARS   Latest post by Jim Bratt: Is my car any good?   AIRPLANES   Latest post by Lucy Hawthorne: What's wrong with my Boeing?   ... etc. Therefore, I need to do a select in order to find each subject, and then a select top 1...order by subitteddate DESC to find the latest post of each subject. Somehow, these should end up on the same datarow of course. I've tried various approaches (WHERE...IN, joins, DECLARE AS TABLE) but can't figure it out. Please help! /Pettrer

View Complete Post

More Related Resource Links

Binding Nested Listviews in MVC ViewPage


I am a longtime .NET developer but for big applications and services.  This is my first asp.net project and I have chosen MVC.   I have a need for nesting a ListView within a ListView.  In this simple catalog app, I have EF 4 Entities that are Categories, SubCategories, ItemTypes, and Items.

My goal is to display a 5 column layout of SubCategories with their ItemTypes below them in a ViewPage.  I did just fine with it done out in C# as server directives such as:

    var subcats = Model.SubCategory.ToArray();
    var nrSubCats = subcats.Count();
    var rows = (nrSubCats/5) + (((nrSubCats % 5) > 0) ? 1 : 0);
    for (var row = 0; row < rows; row++)
    { %>
        <div style="width: 100%; float: left; clear: right;">
        var start = row * 5;
        for (var i = start; (i < start + 5) && (i < nrSubCats); i++)
        var subcat = subcats[i];
            <div style="float: left; clear: right; width: 20%; margin-left: 5;">
                <h2> <%:subcat.Name%></h2>
                    foreach (var its in subcat.ItemType)

MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

Nested Tracers - is there a way to only log the outer trace?



I have some nested tracers. The outer one has a category of 'PageTrace' and the inner ones have categories of 'DBTrace'. When I set the outer category source to 'All' I get both traces. When I switch on the inner trace, I just get the inner trace.

So, my question: is there any way to just log the outer trace events, i.e. the Page Traces.




LDAP nested groups filter


Hi all,

In my organization we use nested groups.

For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.

We may assume that no other group in the LDAP has "kuku" in the name.

I need to create a filter which will return all the users which belong to one of the "kuku"s group.

Obviously, using this filter will bring only the head kukus

(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=.rest of the group DN.))

How can I use wild card to fetch all users which belong to any kuku?

For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))



Editable multiple nested gridview


Greetings everyone,

I've got this page where I display a 3 level nested gridview. First gridview displays data, 2nd one displays data based on the 1st one's row and 3rd one displays data based on the 2nd gridview. All of this works perfectly, including the edit mode for the 3rd gridview. 

The issue comes when I make each gridview collapsible, again, it works fine but when I click on "Edit" on the 3rd gridview all the grids collapse, I can then re-open them and the "edit mode" is still present and I can still save my updated data. But that collapsing thing is quite annoying.

I based a lot of my code from this page: http://www.codeproject.com/KB/webforms/EditNestedGridView.aspx

And I understand how I can fix my issue on a 2 level nested gridview, by simply adding the C# code:

protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
            GridView gvTemp = (GridView)sender;
            gvUniqueID = gvTemp.UniqueID;
            gvEditIndex = e.NewEditIndex;

This makes allows me to save the index and prevent it from collapsing when I'm editing. Unfortunately, because I'm actually editing the 3rd gridview, if I code:

dropdownbox which selects records based on criteria (TODAY, THIS WEEK, THIS MONTH, etc)


I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

Help would be much appreciated

Create databound nested ajax toolkit accordion programatically(In code Behind)


Can anyone guide me in the right direction or give an example of How I would accomplish this?


I have  this so far but kind of stuck on how to do it programtically if I'm using header and content templates 

I have a xmldatasource.. In a nutshell at what point in my code do I need to create a new accordion? does it need to be

in the item_databound handler?


Imports Microsoft.VisualBasic

Public Class AccordionTemplate
    Implements System.Web.UI.ITemplate

    Dim templateType As String

    Sub New(ByVal type As String)
        templateType = type
    End Sub

    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
          Implements System.Web.UI.ITemplate.InstantiateIn

        Dim ph As New PlaceHolder()

        Select Case (templateType)
            Case "Header"
                Dim myLabel As Label = New Label()
                myLabel.Text = "Test"
            Case "Content"
                ph.Controls.Add(New LiteralControl("<p>hello</p>"))
        End Select
    End Sub

End Class



Partial Class Accordion
    Inherits System.Web.UI.Page


How can i access my nested info?


I have a web service that returns information about master projects. Within the return i also get all of the sub project information. I have been using the Applications definition designer to create the ADF. It all works fine accept i cannot access the sup project information in any of the BDC web parts. All i get under the "Projects" variable is BDC.ProjectData[].

How can I access this data? I am using the standard SharePoint BDC web parts.

I have edited the XSL to dump out the xml being send and can see that instead of the projects section containing the expected information it says BDC.ProjectData[] along with another variable ___serializedId. So i suspect its an issue with my ADF but i am completly stuck.

Here is a sample of the web service return

    <MasterProjectTitle>PB test 1</MasterProjectTitle>
    <SupplierId />
    <Country />
    <MasterProjectClass>SNG Vehicle</MasterProjectClass>
    <IncoTerms />

Display a nested child ListView on PostBack while using DataPager on parent ListView


Hello ASP.NET community,

I am having trouble finding how to solve the following issue :

I am using nested listviews to display Sales and Sales details.

The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :

ASPX Markup Code :

<asp:listview id="lvSales" runat="server" onitemdatabound="lvSales_ItemDataBound">
<table cellspacing="0" border="1" width="250" style="border-collapse:collapse;">
<tr runat="server" id="headerRow">
<th scope="col" style="width:30px;"></th>
<th scope="col">SaleNumber</th>
<tr id="itemPlaceHolder" runat="server" enableviewstate="true"/>
<tr id="row" runat="server">
<td style="text-align:center;"><asp:button id="btnShowHideDetails" runat="server" oncommand=&qu

Nested listview fk-problem with insert



My problem is this, i have a nested listview that works fine but if i need to do an insert and the nested listview dont have retrived any values (that is no posts created) i cant get hold of the fk that i need. If i put a hiddenfield in the parents listview with the fk how can i find it in codebehind when i do an insert? 



Local Report - nested objects



I trying to use Object data source for my local report. But the problem is that the datasource is having nested objects and I am not able to access the properties of the nested object.

I tried using =Fields!HomeAddress.Value.Zip as mentioned on this site


but couldn't get it working. Its returns #Error for this field.

I am using visual studio 2010 for developing this report

Please help.






Using an Application Resource in Nested UserControl

Hello This problem has been niggling me for months and I just can't seem to get to the bottom of it. I have a UserControl, let's call it 'UC_List', and the ListBox in it uses a Style which I have declared in my Application.xaml file. When working with UC_List.xaml everything seems fine. I then place 'UC_List' into a UserControl, let's call it 'UC_Summary'. I have declared the namespace at the top of UC_Summary.xaml. The xaml code in UC_Summary now has an Error: Could not create an instance of type 'UC_Summary'. Now I cannot see anything in the Design window, only a warning saying 'Problem Loading, the document contains errors that must be fixed...' However when I run the application everything works fine! After a lot of trial and error I found that the cause of the problem seems to be the Style referenced in the Application.xaml. If I declare the Style in UserControl.Resources at the top of UC_List the error goes away and the graphics in UC_Summary return. I've so far duplicated my Styles into individual UserControls to work around the problem but this could easily lead to inconsistancies. If anyone can suggest anything I would be really pleased to try it. Thank you. Regards Chris

Nested Work Flows in 4.0 Framework

Hi, I want to Invoke an work flow within an workflow. And I should be able to sqlTrack the inner workflow.  

Nested gridview to show category and forum

hi,I would like to do like this forum http://www.vbforums.com/there is category and under its there are all forum of this category to do that , I create 2 tables in DB cat for category have 2 rows ( id,title) and table forum have 3 rows ( id,title,Cat_ID) I can do it with Php but in asp.net I can'tI read in some article to create  nested gridviewI try but I didn't find solution and thanks

Nested Stored Procedure

hi, select ACTIVE,DESCRIPTION from ORGANIZATON i'm using the above query to retrieve data.i'm binding the above two columns to gridview. The  ACTIVE column should be output of the following query. select FIELD_NAME  from TYPE where ID=(select ACTIVE from ORGANIZATION) how to combine these 2 queries?can any one suggest me?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend