I have a SQL Server table full of training course progress. I want to make a report. The report is to be a list of users where each row shows their name, completion status, and percentages. They are to be able to expand each row to show sub-rows which elaborate with section by section detailed stats. What is the best UI control to use in ASP.NET to pair with my SQL data to display this in an easy to read manner?
Dave Ward has a really interesting post on creating a simple data repeater ASP.net page methods and jQuery to display data in a table format. Essentially you will use page methods to send data to the client and format it into a simple table using a micro-template.
As an alternative approach, you could format your data as a html table with the ASP.Net data repeater and use a jQuery plugin to add the paging functionality client side. You may to be careful with this approach, as with a high volume of data your html could become quite large and paging may become important to ensure a quick user experience.
That takes care of your table on the client. To add functionality to expand a row to display detail you can wrap that information in a div tag and attach a click event to show or hide the content.
Sounds like an ASP.NET GridView/ListView combination to make a grouping grid. Check out this blog post for more information: http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html
We have been using Telerik grid controls for similar purpose. They work amazining well.
Related
I have a scenario where we need to show data in tabular form.
there will be 10 different data tables in form so which approach will be good to use:
1. Create html table at runtime based on data.
2. Use asp.net's repeater control.
Main criteria is performance, page should not take more time to load.
A repeater generates HTML. Why reinvent the wheel?
TheGeek's answer is valid. The custom html code you are about to write will not be very different from the code the repeater control is writing.
If performance is your main concern, you should consider using lazy loading.
I am coding online sales for a website. I have a problem on my main page where I would like to show products. I defined a table with 4 columns, but there are over than a 100 products and I need paging for that.
How can I implement paging with 20 products per page?
There are a lot of finished controls that will help you on the way, check this MSDN Article out: Creating a Pager Control for ASP.NET
You could also check out one of the many jQuery Pagers out there, however if you use the jQuery solution all the rows will always be loaded. If you use some pre-built ASP.NET control for it, it will only fetch the number of elements you desire for each page.
If you are dynamically creating an HTML table (and not using any of the built-in controls provided by ASP.net for presenting tabular data), then do the following:
Add TextBox and Button controls to allow the user to input and control the page number to show
Add logic to display the current page number and total pages, items, etc
Change your data retrieval to use the current page number and total number of items per page to only display the items that you want. Ideally you would also only retrieve the items that you need (rather than retrieving the entire dataset and then only showing some of it). There are different ways to do this based on how you are retrieving your data.
Also check out one of the following articles:
Custom Paging in ASP.net 2.0 with Sql Server 2005 - Scott Mitchell
Efficiently Paging through Large Amounts of Data - MSDN, C#
Creating a Pager Control for ASP.NET - Dino Esposito, MSDN
In VisualStudio, when you drag and drop a table or an individual column from a data connection in server explorer, a gridview is created.
What I want to be able to do is drag and drop the columns to make a quick and dirty detail form to display an individual record. Is this possible in any way?
An even better way to do this would be via a custom T4 or LLBLGen template but I have no clue how to do this.
Any other suggested approaches?
UPDATE: A DetailsView is the type of thing I am looking for, in that you can select a data source and the specific columns you want, but I'd like to be able to have manual control of the layout and formatting after the initial drag and drop.
I suggest binding a DetailsView to the table using a data source (SqlDataSource) instead. You might find these tutorials, especially this one helpful.
In response to your update, have a look at the FormView control. It gives you complete control of the layout using templated sections.
There appears to be literally no way to do this in VS that I have come across.
I want to create something similiar to a facebook wall on my social site. I want to store the posts in an sql database and that should be rather simple. What I am looking for is a good way to display the posts? I guess I don't even really know where to start, as I can only think of using a loop to display asp:textboxes. Which obviously is not correct.
I want there to be multiple posts displayed on the page, which should include:
the user who posted,
the text posted,
the date posted,
and if I want to get crazy...a means of deleting/editing the post.
I really have no idea of how to implement this concept, so any ideas would help greatly.
To get started, view this article from asp.net on the Repeater control, or this great article.
The Repeater control lets you databind to a list of objects, and then define one template for how that object should be displayed. Then, ASP.NET will handle showing it as many times as necessary. You can write the code-behind for dealing with delete and edit as if there were only one instance on the page.
go ahead with jquery, use a lot of ajax. for the mark up, use a repeater control with all clean html mark up (instead of server side controls which would generate a lot of unnecessary mark up quickly creating performance issues)
only populate x number of items on initial load, and then using jquery pull data as required based on user action. you can serve this data via json, decode json on client side using jquery and perform a loop which converts this json into appropriate html and injects it into the correct html element
should be simple ;-)
ASP.NET gives you lots of ways to do this. A Repeater, DataGrid, GridView are the first that come to mind. If you'd rather use ASP.NET MVC, there's always the good old foreach loop.
Additionally, check out ListView too.
And this was supposed to be so easy...
I have existing business and data access layers that handle the retrieval and update of the data in question. These work great with the existing Winforms application (.Net V2.0)
Now, in trying to write a new web-based UI, I'm running into all sorts of problems (last time I wrote asp.net code was in 1.1). Specifically, I can't data bind a text box to a business object. Oh, sure there's the ObjectDataSource but that wants to know how to do CRUD operations on the data.
What I'm looking for is something that acts like the classic binding objects so that, in my code, it's as simple as retrieving the object and doing a a refresh. The data component like FormView and DetailsView are so generic-looking that it's ridiculous. The existing application would have tabbed dialogs, text boxes grouped by panels, etc.
On top of that, I have a directive to use master pages and unless one control causes it, I can't seem to get the content section to expand. I can't just put a text box below the bottom of Content1 and have it re-size the content section - which gives me the same results as an earlier question I posted when the footer wasn't being pushed down - relative position solved that but doesn't seem to solve it with placing small text boxes in the area.
What I want is fairly simple. Something like:
bindingobject.datasource = businessdataobject
bindingobject.refresh
...and have the text boxes refresh with the new values. Likewise to have businessdataobject properties updated as the user enters new data.
I was able to do this with the GridView (grdRequests.DataSource = lstRequests) by making a list of asp:BoundField tags inside the <Columns> collection of the GridView.
Am I tilting at windmills here?
Why don't you give the Patterns and Practices (1) ObjectContainerDataSource a try? It's part of the Web Client Software Factory which is available (2) here.
I've used it a few times, it gives you the ODS-style design experience (design time binding) but full control over how you provide the data source. You just implement the events you are interested in (e.g. Selecting event). It also has server side paging and sorting support so it's quite useful for GridViews.
It might not be flexible enough for what you aretrying to achieve, but it's probably worth checking out if only as a PoC.
[ (1) http://www.codeplex.com/websf/Wiki/View.aspx?title=Object%20Container%20DataSource ]
[ (2) http://www.codeplex.com/websf ]