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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:46:59+00:00 2026-05-31T00:46:59+00:00

I have a problem that has been a thorn in my side for nearly

  • 0

I have a problem that has been a thorn in my side for nearly a week. I have a site that users can create an account and load videos of there choosing from a database. I would like the videos to show up in a certain order on there page when they look at the ones they selected. My problem is that the videos show up in a random order. I know this may be basic but I am just now entry level (has only been two weeks since I graduated). All the functionality works, so no help needed there, just this darn order thing.

Specs:
Coded in C# ASP.NET
They add and delete selections via checkbox list.
I have the items databound so I can add and remove videos on the back end.

I know this may get me some minus votes, and though I would prefer it not, I just need some help with this issue to be done with the whole project. Before you yell at me for not having code, please tell me what you would like to see so I don’t add tons of useless code.

I am not trying to me short, rather I am frustrated that everything I tried won’t work.

Thank you in advance.

EDIT:
Here is the SqlDataSource for it:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:fivideoConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:fivideoConnectionString.ProviderName %>" 

    InsertCommand="INSERT INTO dealervideo(DealerRecID,VideoRecID) VALUES (?,?)" 
    DeleteCommand="DELETE FROM dealervideo where RecID = ?" >
         <DeleteParameters>
             <asp:SessionParameter Name="recid" SessionField="videorecid" />
         </DeleteParameters>
         <InsertParameters>
             <asp:ControlParameter ControlID="hidRecID" Name="recid" PropertyName="Value" />
             <asp:SessionParameter Name="videorecid" SessionField="videorecid" />
         </InsertParameters>

</asp:SqlDataSource>

And here is the Gridview:

<asp:GridView ID="GridView2" runat="server" 
        DataSourceID="SqlDataSource2" AutoGenerateColumns="False" 
        DataKeyNames="RecID" CellSpacing="5" BorderStyle="None" BorderWidth="0px">
    <Columns>
         <asp:TemplateField HeaderText="Delete">
            <ItemTemplate>
                <asp:CheckBox ID="cbDelete" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />          
     </Columns>
    </asp:GridView>

And this is the event when they click to add a video to the list:

protected void btnAddVideo_Click(object sender, EventArgs e)
{
    foreach (GridViewRow gvr in GridView3.Rows)
    {
        CheckBox chkItem = (CheckBox)gvr.FindControl("cbAdd");
        if (chkItem.Checked)

        {
            String sRecID = GridView3.DataKeys[gvr.RowIndex].Value.ToString();
            Session["videorecid"] = sRecID;
            SqlDataSource2.Insert();
            SqlDataSource2.SelectCommand = "SELECT * FROM dealervideo inner join videos on videos.RecID = dealervideo.VideoRecID inner join dealers on dealers.RecID = dealervideo.DealerRecID where dealers.RecID = " + hidRecID.Value;

        }
    }
    GridView2.DataBind();
  • 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-05-31T00:47:00+00:00Added an answer on May 31, 2026 at 12:47 am

    Add an “ORDER BY” to your Select Command and the field which you want it to be ordered on.

    Example:

    SqlDataSource2.SelectCommand = "SELECT * FROM dealervideo inner join videos on videos.RecID = dealervideo.VideoRecID inner join dealers on dealers.RecID = dealervideo.DealerRecID where dealers.RecID = " + hidRecID.Value + " ORDER BY videos.RecID";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a reoccurring DNS problem that has been plaguing our users, occasionally causing
I have a really silly problem that has cost me a load of time
I have a problem that has been stumping me for a while, I wrote
I have a problem that has been bugging me all day. In my code
I have a problem that has been nagging me for some time now and
I have a problem that has been consuming me for days. I have a
Hi I have some problems that has been bothering me for a week. I
I have a problem that is and has been perplexing me for hours. I
I have a problem that has been effectively reduced to a Travelling Salesman Problem
I have a database that has been populated with some data using create and

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.