Run different stored procedures based on user input

Posted on 2011-10-14
Last Modified: 2012-06-21
I have an ASP.Net page (C# code behind) that displays data in a grid. The OnLoad event runs a stored procedure to get the data from the database and display the grid (an asp:repeater, actually). I have placed 5 buttons at the top of the page. When the page is loaded (as a user comes to it) a default stored procedure is run. I want each of the buttons to run a different stored procedure that accepts a different parameter. Right now, the page opens and displays all open records. When clicking the Archived button, all archived records will display. When clicking the Returned records, all of the records marked as returned will display. And so on. The parameter is simple, a status field that is a number. What would be the best way to implement this?
Question by:dodgerfan
    LVL 22

    Accepted Solution

    LVL 15

    Expert Comment

    if all the data is already in the client side, add class to the rows and with jquery hide/show relevant rows.
    if server side you have at least 2 options
    1) use linq to filter the result (to better performance save the first result and use it in the next page calls)
    2) pass a parameter to the stored procedure that will filter records as needed

    Author Closing Comment

    Perfect, thanks.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now