Scenario: Client maintains financial/compliance record in a spreadsheet for each quarter of the year. Spreadsheet contains columns which are not static, they can change from quarter to quarter and will not be same the next year. They want a portal by which all the regional managers (of stores/franchise) can enter their data and at the end aggregated at the national level.
Issue: As you could have guessed, I want to develop the spreadsheet column into sql table with all the columns, but the issue is that they want to add new columns dynamically (for future quarters) via admin side. Thinking of providing a textbox (columnname), dropdown (sqltypes possible) and add button which will basically add the column. But the columns can grow and that's not the right option, I guess. Other alternative is, instead of adding columns, I can add it as rows and then use PIVOT to do the sql part.
If anyone of you have developed this kind of application, could you please aware me of any complications before I proceed further with my idea of adding rows instead of columns for adding fields for the reports dynamically. If anyone has got sample example or reference online, please divert me there.
Take a look at Umbraco. It's a cms that puts the concept of PIVOT into practice. (Actually I believe most CMS does).
Actually, I'd go so far as to suggest building that application of yours in Umbraco. You will need to customise it a bit, but you will have quite a bit of heavy lifting already done for you, such as authorisation, membership, and the schema/content mechanism.
Related
I am currently trying to create a project in ASP.NET to create a stock input web application for a cafe which allows users to input stock data from web. I want to know how to save data from browser to SQL Server.
Screenshot of my current table design / ERD
The Item table will hold all information about each item. Stock_Take_Item table will hold the quantity of each item for a stock take, and Stock_Take table will hold the date of the stock take.
I want to be able to present the user with three columns, One for item description (which will already contain the item descriptions in), the second column for Bar Quantity and able the user to input this value and the third Column for Storage Quantity and also allow the user to input this value.
Once a user has filled out the columns for the stock take, will then press a submit button which will trigger c# code to insert these values into the SQL Database.
I hope this isn't too long winded and someone can give me a good recommendation on how to do so. I fully understand my tables may be wrong, and am open to changing them.
This is not actually a question of the specific problem. you rather need to read a very basic tutorial of ASP.net application.
For your convenience, I suggest you to read This Basic Example which exactly does what you need and just the table name and field names differ. I suggest you read this up first and then come here for very specific questions.
I am encountering a situation such as, I want to offer a data entry form of almost more than 100 fields of certain Database Table. It was an old database of Invoice of a particular company and cannot be altered.
So, I would have obviously a resultant Data Grid ( Probably HTML Table ) or MVC Grid containing user entered data inside. But the problem is How to Offer 120 fields in an entry form? ( Could be a partial View contained inside JQuery )? This comes an idea about inline editable Grid. Would that be better? Or DevExpress offers such controls? Would Spreadsheet be helpfull?
or any other technique would be helpfull to adopt for this?
Any body having any idea?
Regards
Usman
OK. I don't think a Grid would be a good way: that would just be too wide. I think the best way would be a series of Tabs each of which contains the data pertaining to one logical section of the invoice (e.g. a section for Forwarder, another for Client, etc etc).
As a design note, try to group items into sections small enough that the user doesn't need to scroll. Everything is a section should be visible of a normal sized screen. This makes it easier for the user.
Not sure if this is possible in your case but since you mentioned
any other technique would be helpfull
This is what I can suggest: In Visual Studio (download free copy here http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx), in your MVC project:
Add Entity Framework package from nuget if you don't already have it (Install-Package EntityFramework from Package Manager console in VS)
Add an EF model in VS by dragging you database table to model designer
Add an Entity Framework controller with Read/Write Actions
This will create views in your project where a user can go an CRUD the table rows. And will also ensure basic constraint checking.
Check this tutorial for Entity Framework details: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application
I have requirements to implement a UI using c# where the user can manipulate what data they want to appear on a document. The data should enter the program via SQL (prefer not using Table Adapters as the database is then hardcoded into the program, but will use it if absolutely necessary).
The following UI will appear when the user chooses to enter a database table:
https://docs.google.com/file/d/0B6b_N7sDgjmvcUt2amxNaXpJRFU/edit?usp=sharing
https://docs.google.com/file/d/0B6b_N7sDgjmvdUhmMUJFbEdKeVk/edit?usp=sharing
https://docs.google.com/file/d/0B6b_N7sDgjmvM3BSWDEyM0ROOFE/edit?usp=sharing
The user should be able to choose what columns (from all tables,
connections should be made using PK/FK.) they want to add to the
table, and sort and move that data.
The control should then able to generate the sql used to pull that
information from the database (or even pass the database back to the
main program, but prefer SQL)
I've seen this UI in many programs and would like to think there is a library out there that will save me the trouble of making this UI from scratch.
Are there any libraries available for C# that has this kind of functionality?
Telerik's Rad Grid will give you all of the functionality in terms of context menus and column reordering. You wont be able to output the code needed to regenerate the table however. You can export data directly from the grid using the column ordering specified in a range of formats (pdf, word, excel, etc.).
The Rad Grid is also not free, it is part of a suite of controls.
You may also try DevExpress. We use this control library for editing operations. It is not free but worth its price.
I'm working on a web app in ASP.NET MVC 3 using the Razor HTML 5 engine and C#. The client wants something pretty complex and I would like to know if there is any examples out on the web that might show me how to begin setting this up. Here's what they are looking for:
I have a very large SQL database (25,000 rows). They want to be able to select the data using three different views on the same page.
The first will be a tree and using similarities in certain columns of the table will be how the tree is broken in to sections.
The second will be a grid. This will be just one entire list of the everything in the database that you can scroll through. Of course there has to be some sort of virtual scrolling because loading 25,000 rows rather quickly isn't going to happen.
The third will be a search box where you can type in the code and select it that way.
All three of these need to be linked so that when you type a code in the search box it will select it in the grid and in the tree. If you select it in the tree then it will be selected in the grid, and if you select it in the grid then it will be selected in the tree.
They also want me to remember the last selection when you navigate away and be able to type a code n on a different page and go directly to this page with the item you typed selected. Therefore, I need to be able to use MVC's capabilities to establish a hyper link for every item in the list (I assume that would be the way to do this)
This is honestly the first time I've worked with ASP.net MVC and I feel like I may have bitten off more than I can chew with this project so any help would be greatly appreciated!
They would rather it if I didn't need to include any extra dll's so if there is a way to do this without third party tools that would be even better, but at this point I'm just looking for anything.
A few random ideas/thoughts about this:
This is kind of a big project as your first MVC app - hopefully you have some experience with HTML/Javascript/jQuery since it's going to require a fair amount of glue code to make everything work together. There is no "here, do this" solution.
There are a bunch of different free/open source projects for treeviews and grids. I've used jqGrid for a number of projects - it works well. It has a decent API and is fairly configurable (although it may take some digging to find the example code you need).
For a treeview, you can try jsTree. I haven't worked with it, though.
I'd suggest starting with just the treeview, or just the grid and get it working first. Then add the other control and get it working. Then add the search. Finally, I'd work on getting everything to work together.
To handle navigating to a specific selection, you can pull information off the query string from Javascript.
Realize that most of this is going to be happening in Javascript on the client side, not much server side.
I have an ASP.NET application that displays various views into a largish database of protein sequences. As a visitor browses the data, I'd like for them to be able to select a CheckBox in the GridView row to flag sequences for later download as a zipped text file. I don't want to store the selections so they should just be valid for the session.
My idea right now is to add a TemplateField to the GridView and then add a CheckBox to that. I intend to handle the check events and store the sequence IDs in the session state. When the user heads to the download page I'll get the session data, display the list of sequences they are about to download and then send the file along. Obviously I'll also have to reparse the session data on every form load / page switch.
So I actually have a couple of questions about this:
1) Am I doing too much work? Is there an easier way to implement this?
2) Are all the round trips to the server for the session state likely to be a performance problem? I can put a "Save for Download" button on the page to batch it to help things. Handling the check events just seems more error tolerant since you can't accidentally lose your state if you navigate away.
3) Is it possible to sort the GridView by the checked box column? I'd like to sort by the checked box column first then the currently sorted column (e.g. If the GridView is sorted by last name, sorting by the check column and then by last name).
In case it matters, I'm using C#, .NET 3.5, VS2008 and I'm using the simple drag-n-drop way of creating a GridView from a SQLServerExpress table.
Use AJAX via a Page Method to keep track of the checkbox status in the session state. This will minimize the round-trip cost.
I don't think you'll be able to sort by the check box in the GridView as you need to specify the sort column. You may be able to do this by making a synthetic data source that basically joins your saved session information with the data from the table but not by using a SQLDataSource connected directly to the table.
I'm not sure there's an easier way to do it, but as for your other questions:
2.) You need to decide for yourself the balance between robustness and network traffic. If you use the check event, you're going to go back to the server quite a bit. If you use a different event (losing focus on the grid, an explicit "update/save" button click, or navigating to another page), you cut back on traffic at the expense of possibly losing information. It's a UI design decision with no "right" answer.
3.) It's possible, though it may not be automatic. I know that DataGridViews will generate handlers to sort by checkbox columns automatically. I'm not sure it's that easy with the regular GridView. Is there a reason you're using a GV and not a DGV?