I have a database where I want to display 2 records in a nicely formatted ASP.NET with HTML
Each record would look like this on the web page
The layout would be layers. The data is in a SQL Server 2008 r2 database.
Now whats the best way to get data to populate each record.
Repeater? Or another method?
Regards
Tea
The repeater control is an easy control to use to make sure that your data is displayed the same for all entries in a given data source.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx
This looks like a template and will follow the same html for each entries so it would be better to go for repeater as you will have more control over the html,css and the placemnet part.
yes repeater is best option to use in this situation or you can generate the whole html on you code behind page and assign it to a literal control.
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 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.
I have various SQL tables and my use case is:
I'll choose 5 Products at random and they'll show in X control (don't know what to use here).
I know I'll have to use SQL and pull the product information using the ProductID as the hook to fish out every other information.
What Control should I use?
---If you want to show random product, then Adrotator is the best choice
---If you are getting product randomly from DB then Repeater or datalist could be the best choice
Depends how you want do display it.
Maybe a Repeater and ObjectDataSource will be useful, depending on your ORM.
Maybe a DataList, maybe a Repeater. explain more about what you want to show.
Two possibilities spring to my half-asleep mind.
the first would be to use a ListView or Repeater and have it themed out appropriately.
The second possibility would be to create a user control that displays the way you want, and then instantiate 5 instances on the web page.
I would make a user control that would take an array of ids as a property. Encapsulated in the user control would be everything you need to do to display your products. This would probably be an array of panels with images and labels.
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'm using the Repeater control on my site to display data from the database. I need to do pagination ("now displaying page 1 of 10", 10 items per page, etc) but I'm not sure I'm going about it the best way possible.
I know the Repeater control doesn't have any built-in pagination, so I'll have to make my own. Is there a way to tell the DataSource control to return rows 10-20 of a much larger result set? If not, how do I write that into a query (SQL Server 2005)? I'm currently using the TOP keyword to only return the first 10 rows, but I'm not sure how to display rows 10-20.
You have to use the PagedDataSource, it allows you to turn a standard data source into one that can be paged. Here's an example article
This isn't a way to page the data, but have you looked into the ListView control? It gives the flexibility of repeater / data list but with built in paging like the grid view.
And for paging in sql, you would want to do something like this
This was answered here.