Programatically populating ValidValues property of ReportParameters in .NET for SSRS - asp.net

I am trying to populate an SSRS parameter's ValidValues property at run-time without writing custom stored procedures. The issue is that the available values for a certain parameter change depending on a user's security level. I'd like to keep the logic for it in the code rather than in stored procedures. Is there a way to populated ValidValues for ReportParameters in .NET for SSRS?

have you tried creating a data set (either a select statement or sp) to pull the possible values? you can then set the parameter to use the data set.

Related

How to assign dynamic data source to GridView using Entity Framework?

I have an Stored Procedure which may return some unpredictable rows and columns, based on some business logic written in my SP. That is for sure that it will return only one set of Result Set data from this SP.
Whatever the result my SP returns, it should be reflected into my GridView. Due to some framework restrictions, I can not use ADO.Net DataSets/DataTables.
I am using Entity Framework 4.0 for my project and I want some solution to bind my GridView with dynamic nature of DataSource returned by my Stored procedure.
I think, this is very common problem which many developer has encountered in such type of situation.
Is there anyone who have found some work around to achieve the goal within the boundary line of Entity Framework?
Note: Keep in mind that, I don't want to use ADO.net DataSet or DataTable.
I think you are fetching data from proc and stored in List like that.
List<HRDocumentCheckList> searchJoiningDoc = GetJoiningDocumentForEdit(ddlCategory.SelectedValue.ToInt32(), false).ToList();
gvJoiningDocumentTemplate.DataSource = searchJoiningDoc;
gvJoiningDocumentTemplate.DataBind();
Just bind the gridview and set the autogenrated column is false
Hope it will helps you

How do I intercept a filter on either RadGrid or ASPxGridView for ASP.Net?

I need help choosing between Telerik RadGrid and DevExpress ASPxGridView for Asp.Net based on unique filtering requirements. The data lives in denormalized Vax files. All data access is via Sql Server stored procedures calling ODBC Connx queries to the flat files. Stored procedure parameters are used to filter the data. Without any filter thousand of records are returned.
I've successfully displayed all records on two test ASP.net pages, one with DevExpress ASPxGridVIew and the other with Telerik's RadGrid. In code I databind each grid to the stored procedure that returns over 26,000 rows. The sproc is called via an Entity Framework function import that fills an IEnumerable<Customer> which becomes the datasource of each respective grid. I'm able to use the filter features of both grids and they seem to work nicely.
My problem is that before the grid filter is applied all of the thousands of rows are returned from the stored procedure. I'd like to intercept the grid's filter parameters and apply them to my stored procedure parameters. That way far fewer records will be accessed.
Can this be done with either 3rd party grid and if so how?
Thanks in advance.
It seems it can be achieved using a RadFilter to the RadGrid. One example here.
But in general, looks like you'd need to add a handler to ItemCommand, and perform the appropriate filter based on the CommandName, for example. You could then just rebind the data.
The Rad Filter will also allow you to use it without being directly tied to another control or datasource. The filter has an option to extract a filter expression in many different forms (linq provider is one of them). You can then apply that expression to your datasource. We are doing something similar. We have a page where we dynamically create the rad filter with the types of fields and filter options. The user then uses the rad filter UI to create the filter based on the desired fields, then we extract a filter expression we can apply to a datatable that is created on the page that shows the data.
Here is the code for extracting the filter expression from the filter:
var provider = new RadFilterSqlQueryProvider();
provider.ProcessGroup(myRadFilter.RootGroup);
var sqlFilterExpression = provider.Result;

Reporting Services and checkboxes to specify WHERE Clause

I have a report embedded in an ASP.NET page. The ASP.NET page has some checkboxes that the user can select which datapoints they want to have show up in the report.
In the code behind file I am setting up part of the WHERE clause to be used in the query based on which checkboxes are checked.
I am putting this string into a report parameter and am not sure how to implement that parameter in the query. Simply placing the parameter in the query thinking the value of the string would come across does not work. I have the correct syntax in the string that is being passed into the report.
How do I properly use a Report Parameter to alter the WHERE Clause of the query?
I am using SQL Server 2005.
Base the report on a stored procedure that takes a BIT parameter for each of the checkbox values.
Build the dynamic SQL in the stored procedure and execute it.

Why data binding does not remember the old values?

I have a classic ObjectDataSource and a ListView in my page. The List view just displays some data and when switched to edit template it allows the user to change the values. I want the user to edit just some values -- so I bind just these ones in the edit template.
The problem is that the other values suddenly turn to nulls or 0. I tried to bind all of the values at once and it works fine, but I cannot understand why the old/original values just disappear. Is there any way how to bind the old values?
Thanks for help.
The problem is, that only the data that is included into a round-trip to the server will be available in the postback. That includes all that that is bound to BoundFields, TemplateFields or if the Propertyname is included in the DataKey (or DataKeyNames, don't know right now).
The best approach to fix this, and to keep the overhead to a minimum is to add your primary key to the DataKeyNames collection. This allows you to have access to your custom object that contains an unique identifier and all properties that have just changes.
In your Update Method of the ODS (in your custom class) you now need to retrieve the old object by its unique identifier, manually assign the new values and saves your object back to the database

Split Table column in Dynamic data

I am using an integer field in the DB to represent collection of booleans in order to save some space. the integer is used in my Business logic and transformed into collection Boolean attributes.
i'v now decided to add "Admin" section to the site using Dynamic data feature, and i am wondering whether there is an option to show the Booleans that represent that integer.
i know how to Hide a certain column (avoid scaffold) but i don't know how to add "virtual" column to the Dynamic control.
Maybe Sql View is the answer here? is there an easy way to bind the dynamic data into SQL view instead of the real table?
Have you tried creating a custom field template that would handle the logic of splitting/"joining" the boolean values into an integer?
MSDN:
http://msdn.microsoft.com/en-us/library/cc488523.aspx
Video:
http://www.asp.net/learn/3.5-SP1/video-291.aspx

Resources