Personal Web & Sample Site
Skip Navigation Links
HOME |
About Me |
Articles
| Contact Us
Basic Reporting - Declarative Parameters
Rating: 4 user(s) have rated this article Average rating: 5.0
Posted by: joet, on 8/2/2011, in category "MS SQL"
Views: this article has been read 3615 times
Location: Houston, Tx, United States
Abstract: In the example below I used a text box to pass in the parameter and filter out all suppliers by country. The difference here is that when the page loads the text box is empty but the gridview's object data source is still invoking the select statement but returning a NULL value. What if we want to show the entire list of suppliers everytime the page loads. Then the visitor can enter a country and filter the list. The point is that we can now simply modify the supplier class file method "GetSupplierByCountry" with the following code.

 

 In the example below I used a text box to pass in the parameter and filter out all suppliers by country. The difference here is that when the page loads the text box is empty but the gridview's object data source is still invoking the select statement but returning a NULL value. What if we want to show the entire list of suppliers everytime the page loads. Then the visitor can enter a country and filter the list. The point is that we can now simply modify the supplier class file method "GetSupplierByCountry" with the following code.

 

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
    public jtwebnet.SuppliersDataTable GetSupplierByCountry(string Country)
      {
         if (string.IsNullOrEmpty(Country))
         return GetSuppliers();
            else
         return Adapter.GetSuppliersByCountry(Country);
      }

 

Go here for example!

 


How would you rate this article?

User Feedback
Comment posted by joet on Tuesday, November 26, 2013 2:30 PM
This is only a test!

Post your comment
Name:
E-mail:
Comment:
Insert Cancel

Copyright © 2013 Jose M. Tamez
Last Updated August 18th 2013