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 8819711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:25:49+00:00 2026-06-14T05:25:49+00:00

I have a GridView that is filled with data from a database. I get

  • 0

I have a GridView that is filled with data from a database. I get My data using a mssql function. This is how i am getting my data:

private void GetNoLocationScanAddress(GridView grid, int week)
        {
            try
            {
                FunctionDataContext function = new FunctionDataContext();
                List<Fn_GetNoLocationAddressGroupedResult> address = function.Fn_GetNoLocationAddressGrouped("0X", week).ToList();
                grid.DataSource = address;
                grid.DataBind();
            }
            catch (Exception exception)
            {
                Console.WriteLine("ERROR in GetNoLocationScanAddress() method. Error Message : " + exception.Message);
            }
        }

The Problem is i am already sorting the data in my function. I am also using a Switch case to determine what data is selected for viewing.

 protected void WeekSelector_OnIndexChanhed(object sender, EventArgs e)
        {
            switch (RadioButtonList.SelectedIndex)
            {
                case 0:
                    GetScanErrorsAddress(Grid, Convert.ToInt32(WeekSelector.SelectedValue));
                    Grid.DataBind();
                    break;

                case 1:
                    GetScanErros(Grid, Convert.ToInt32(WeekSelector.SelectedValue));
                    Grid.DataBind();
                    break;

                case 2:
                    GetNoLocationScanAddress(Grid, Convert.ToInt32(WeekSelector.SelectedValue));
                    Grid.DataBind();
                    break;

                case 3:
                    GetNoLocationScan(Grid, Convert.ToInt32(WeekSelector.SelectedValue));
                    Grid.DataBind();
                    break;
            }
        }

Function sql:

SELECT     TOP (100) PERCENT Request1.RequestID, TrackIT.dbo.Sending.Barcode, TrackIT.dbo.Address_View.AdrID, TrackIT.dbo.Address_View.Name, 
                      TrackIT.dbo.Address_View.Street, TrackIT.dbo.Address_View.HouseNo, TrackIT.dbo.Address_View.Postal, TrackIT.dbo.Address_View.City, 
                      TrackIT.dbo.Address_View.Country, Request1.Latitude +','+  Request1.Longitude AS Location,  Case when(Request1.Latitude<>'')then cast(1 as bit) else cast(0 as bit) end AS showLocation, Request1.ReceivedDate
FROM         (SELECT DISTINCT RequestID, LTRIM([Content]) AS Barcode, Latitude, Longitude, ReceivedDate
                       FROM          dbo.RequestWithLocation
                       WHERE      (Site LIKE @Site) AND ([Content] <> '') AND (AddressID = '0') AND (ReceivedDate > DATEADD(day, -@ReceivedDate, GETDATE()))) AS Request1 INNER JOIN
                      TrackIT.dbo.Sending ON Request1.Barcode = TrackIT.dbo.Sending.Barcode INNER JOIN
                      TrackIT.dbo.Address_View ON TrackIT.dbo.Sending.DeliveryAdrID = TrackIT.dbo.Address_View.AdrID

ORDER BY TrackIT.dbo.Address_View.AdrID

Can anyone help me with this ?

  • 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-14T05:25:51+00:00Added an answer on June 14, 2026 at 5:25 am

    You can use – Linq (OrderBy or OrderByDescending), to sort your List<Fn_GetNoLocationAddressGroupedResult>.

    Eg.

    address.OrderBy(x => x.Country);            // ascending
    address.OrderByDescending(x => x.Country);  // descending
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have GridView that allows select. It takes data from EntityDataSource . How do
I have C# application that fills a GridView with data from a DataTable object,
I have a gridview that is filled correctly from 3 tables. When I update
I have an ASP.NET gridview component which is being filled up with data from
I have a gridview that gets data from an sqldatasource and as a results
I have a gridview that contains value of every rows read from a text
I have a gridview that takes in values from a sortedlist. I want to
I have a Gridview that displays paged results from a search query. The problem
I'm using Sencha touch 2. I have store that load from existing js object:
I have a GridView in ASP.net which is filled from an SqlDataSource. one of

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.