Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:22:08+00:00 2026-06-06T13:22:08+00:00

I am creating a website and am facing the following problem. I have 2

  • 0

I am creating a website and am facing the following problem. I have 2 ListViews.
The first ListView is inside a user control called Sidebar.ascx:

<asp:ListView ID="sidebarListView" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSourceSidebar">
 <ItemTemplate>
  <div class="sidebarItem" runat="server">
     <div>
        <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
     </div>
  </div>
 </ItemTemplate>
 <LayoutTemplate>
  <div class="sidebarMain">
     <asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
  </div>
 </LayoutTemplate>
</asp:ListView>

<asp:SqlDataSource ID="SqlDataSourceSidebar" runat="server" ConnectionString="<%$ ConnectionStrings:TudengiDBConnectionString %>" SelectCommand="SELECT [Id], [Name] FROM [Faculties] ORDER BY [Name]"></asp:SqlDataSource>

It has to display only the name.

The second listview is inside my Default.aspx

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
  <ContentTemplate>
     <asp:ListView ID="RecentItemsListView" runat="server" DataSourceID="SqlDataSource1"
        GroupItemCount="3">
        <LayoutTemplate>
           <div class="recentItemsMain">
              <asp:PlaceHolder runat="server" ID="groupPlaceHolder" />
           </div>
           <asp:DataPager ClientIDMode="Static" ID="DataPager1" runat="server" PageSize="9">
              <Fields>
                 <asp:NumericPagerField />
              </Fields>
           </asp:DataPager>
        </LayoutTemplate>
        <GroupTemplate>
           <div class="recentItems">
              <asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
           </div>
        </GroupTemplate>
        <ItemTemplate>
           <div class="recentItem" runat="server">
              <div>
                 <asp:Image ID="PictureThumb" runat="server" ImageUrl='<%#CreateThumbnail((string)Eval("Picture"),130,130) %>' />
              </div>
              <asp:Label ID="AuthorLabel" runat="server" Text='<%# Eval("Author") %>' />
              <div>
                 <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
              </div>
           </div>
        </ItemTemplate>
        <GroupSeparatorTemplate>
           <div class="groupSeparator">
           </div>
        </GroupSeparatorTemplate>
     </asp:ListView>

  </ContentTemplate>
</asp:UpdatePanel>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TudengiDBConnectionString %>" SelectCommand="SELECT [Id], [Name], [Faculty_Id], [User_Id], [Author], [Picture], [Location] FROM [Books] ORDER BY [DateAdded] DESC">

What I need is for the ListView in Default.aspx to display the data without a WHERE clause, but when an item is clicked in the Sidebar user control I need to update the Default.aspx ListView to display only the data where the [Faculty_Id] = the ID of the ListView item in the user control.

How can I get the database ID of the ListView object when I can only display the NAME field? Do I have to display the ID as well and then hide the column from users?
What is the correct way to solve a situation like this?

Thanks for helping

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:22:09+00:00Added an answer on June 6, 2026 at 1:22 pm
    <asp:ListView ID="sidebarListView" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSourceSidebar" OnItemCommand="sidebarListView_ItemCommand">
    <ItemTemplate>
      <div class="sidebarItem" runat="server">
         <div>
            <asp:LinkButton ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' CommandName="Select" CommandArgument='<%# Eval("Id") %>' />
         </div>
      </div>
    </ItemTemplate>
    

    This is what I ended up with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on creating website with Yii framework and I have a problem
When creating a website using Asp.Net and using controls such as the ListView is
I'm Creating a website for online reading stories using grails and i'm facing a
Actually, I am facing a problem in Android. I am creating an application that
I am creating a website in asp.net but i have some issue.. I have
I currently have healthmonitoring implemented for a public facing website. I am using the
I am creating a website using JavaScript/ASP.NET/C#/CSS/HTML/Compact SQL server. I have the majority of
I am creating a website using Python and the Bottle framework for the first
I am creating a Mobile website using Asp.net and i am facing a XML
I have been creating my website on a local environment and I had no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.