Interactive search results table - asp.net

In Asp.net using Visual Basic code I want to be able to query a database after a user inputs search criteria, get the results and display them in a table, with the ability of the user to click/select individual results and delete the corresponding data from the database. How can I do this?

You can do this by utilizing a Datagridview and binding data to it (by using OLEDB for example). Use the WHERE clause in your query to filter the records, based on the user input. (http://www.w3schools.com/sql/sql_where.asp)
The Datagrid has events you can use (delete, select, insert and update event).
See for more information: https://code.msdn.microsoft.com/VBASPNETGridView-19039173
Good luck!

Related

What is the proper way to add records to a V2 odata model with two way binding in SAP UI5?

I have a SAP UI5 V2 odata model with a two way binding to a table and to a form.
The table is displaying all records, and when clicking on a record, I am using setBindingContext to bind the selected table record to the form for editing. When typing in the form, the values dynamically update in the table (because of the two way binding). model.submitChanges() writes the change back to the server.
So displaying the list, and editing records in the list are working just fine.
Now for the problem How to create records with the same form?
I also want to use the same form for adding new records, but I cannot figure out how to unbind the form from a previously selected record, or otherwise create a new blank entry in the data model to be sent to the server.
All of the tutorials I have been able to find on doing UI5 Odata CRUD operations don't really address this problem.
I discovered this example in the documentation which pointed me in the correct direction.
In summary, you use the oModel.createEntry method to create a new entry in the oData Model. You then have to bind this new entry to your form with setBindingContext - this is the part I was missing.

Search Operation in table view javafx

In my application i added all data into table view. Then I need entire row by using search operation.
Searching is based upon any data like search by RegisterNo or search by Name. By entering RegisterNo it Should display entire row related to RegisterNo.
To do search operation in a TableView, what I've done is to add a notion of filters.
For example if you want to filter by name, each time your name query change, you filter all your data and let on the table only those who match your query.
You always keep the full data to execute your query on it, but to display it use an other list.
with that I'm able to have lot of filters at the same moment and my view refresh in real time

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;

How to prepare attendance sheet in asp.net?

I want to add a attendance sheet for HR record purpose, where they save attendance of different employees. Then I have to retrieve those records on different pages on searching respective fields.
If you are using a gridview to accomplish your task you can use the SQLDataSource control which will allow you to perform different commands like insert, edit and update.
Here you can use GridView.DataBind Method to bind data to your gridview.
The article about Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control will give you a better idea of doing
This is rather a database design question then asp.net. Starting from a simple design, first you need to have an Employee table (Call it Employees) with all employee names & secondly an attendance table which will record each employee attendance. Refer to my sample schema

Binding gridviews to viewstate until being able to write to database

I recently began working on a project which has many gridviews on a single page. During creation of a new record, the user needs to be able to add/remove/edit these gridviews and then save to the database at the end. The problem with this obviously is that there is no datasource to bind the data too until after its written to the database.
This data represents a 1..* relationship, which is why the gridview data cannot be written to the database until the parent record has been created first.
The best way I have found so far to solve this is to use viewstate. This solution however does not seem ideal to me. I am also forced to manually create the gridview functionality with OnDeleting, OnUpdating, etc so that I can manage the binding of the viewstate with the gridview.
Does anyone have any suggestions on a better way to manage this situation, it seems like it would be a common thing?
UPDATE:
Keep in mind this data needs to be around throughout postbacks.
Use a DataSet as an intermediate connection to your data source. Fill the DataSet with your data and then bind your GridView to the DataSet setting the GridView DataMember to the name of the table it is supposed to bind to.
As the user updates tables it will add/modify records in the DataTables in the DataSet. When the user is done editing and clicks "Save" your code can then update the database from the datasets, either automatically using a DataAdapter, or manually looking at the RowState of the rows in the DataTables.
Use a DataAdapter and a Dataset. Invoke the fillschema method in the adapter to create de metadata (cols, constraints, relations, etc) in the dataset. bind the data tables created to the different grid views. update manually cheking each row rowstate on each table or call the adapter's update method to do it automatically. If you do it automatically you need to define commands for insert, delete, and update in the adapter.

Resources