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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:59:02+00:00 2026-05-25T06:59:02+00:00

How can I change my selecommand, and keep it through the remainder of the

  • 0

How can I change my selecommand, and keep it through the remainder of the page (when using pagination, sorting)?

I have a page of checkboxes:

<input type="checkbox" name="checkbox_1" />
<input type="checkbox" name="checkbox_2" />
<input type="checkbox" name="checkbox_3" />
<asp:Button runat="server" Id="CustomButton" text="Create Report" PostBackUrl="report.aspx?"/>

Then on report.aspx I want to generate a standard listview based on the selections in the checkbox.

 <asp:ListView runat="server" ID="ReportListView" DataSourceID="ReportListViewSDS">
  <LayoutTemplate runat="server">
       ...<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />...
  </LayoutTemplate>
 <ItemTemplate>
     ...
 </ItemTemplate>
</asp:ListView>

I want to be able to sort and paginate that listview. This is an idea of what i want in the code behind:

Protected Sub ReportListView_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)

     ' What's the correct way to reference the listview?  
     ' When I use the below code i get "ReportListView is not declared...."

     ' ReportListView.SqlCommand = "SELECT " & checkbox1 & ", " & checkbox2 & " WHERE..."

End Sub

I’m not sure if I’m even going in the right direction with this, any help is appreciated. Will the changes i make to the sql command in the PreRender function hold when I have applied pagination or sorting to the listview?

  • 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-25T06:59:03+00:00Added an answer on May 25, 2026 at 6:59 am

    Actually this was much easier than I thought. Sorry, just a newbie mistake i guess. i ended up simply doing:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SqlCommand As String
        ' create the sql command using the Request.Form vars i wanted.
        ' ...
        ' Run the sql command, I can access the listview directly, just like a global variable:
        ReportListView.SelectCommand = SqlCommand
        ReportListView.DataBind()
     End Sub
    

    And that seemed to do it. Actually very easy.

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

Sidebar

Related Questions

How i can change the color with gradient??? I have this now,but is different
I understand that I can change a sql table using the follow sp: EXEC
I can change SQL at runtime. Can I do the same with LINQ ?
I can change the irb prompt mode with irb --prompt prompt-mode I can see
Where I can change compiler options for C# project in VisualStudio 2008 (without command
I know I can change the selectionStyle of a UITableViewCell to make it highlight
How I can change the individual region background color of viewport extjs 4. Here
I am wondering if I can change the value of io.sort.mb per job? I
Is there a way I can change the icon of the expander to +/-
I want to know if you can change how a highcharts.js chart is rendered.

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.