How to display different data from the same table in Repeater that exists in many pages of the website? - sql

I have a Repeater that shows safety messages from the Safety Messages Table in the database. Since I will put this Repeater in many pages of the Website, I want to this Repeater to show different messages in each page. For example, if it shows message#1 in this page as a first message then message#2 and so on, it should show message#10 as a first message in the other web page and so on. So how to do that?
My query is very simple like this:
SELECT MessageID, MessageDesc, MessageAuthor FROM [SafetyMessage]
Is this issue related to the query? Or it can be done from the Repeater itself?
UPDATE:
I want the repeater to show the data from the database in each page in different order

What you want is called "paging support". Here is an article with an example of how to do it.
Edit: Based on further information from OP...
It sounds to me like what OP is asking for is paging and sorting.
This article explains how to do paging and sorting with a repeater control.

Related

Razor Pages horizontal Table

Good morning,
I am developing my Web Application using .Net Core 3.1 and Razor Pages.
In my application I need to display a large amount of data on a grid and would therefor like to rotate a standard grid 90 degrees. I would like to obtain something like the "Horizontal Scroll" of this blog post but instead of just scrolling horizontally I would likle to move the headers to the side and, as mentioned above, rotate the entire grid fields.
I can't find any API that suites my needs though. Does anyone have suggestions on something I could try? I wouldn't want to have to build the entire grid myself (with all the paging, filtering and ordering logic). I am open for alternative solutions as well!!
Thanks everyone!
This seems more like an HTML question, and does not really relate to Razor Pages. Here are a couple of examples of horizontal scrolling HTML tables:
https://mdbootstrap.com/docs/jquery/tables/scroll/#datatable-horizontal-scroll
https://datatables.net/examples/basic_init/scroll_x.html
You said you need to display a large amount of data, I think the
design you currently want is not suitable for the display of a large
amount of data.
Because if the title is on the left, then only one data can be displayed on each page, and each page needs to load the title, which will lead to great redundancy.
If you just want to display beautiful because of too many columns, I suggest you use the responsive property in jQuery datatable, which can dynamically display the number of columns according to your current page width, and collapse or display the extra columns.
You can refer to this.

Yii CListView pagination linking to previous result

I have a CListView with pagination showing all results. Everything works fine.
I have a search widget on the page that renders a partial view to replace the existing list with search results.
The first search result page loads, looks great, and even shows the correct number of results in pagination, but if I try to go to one of the next pages, items from the first list are loaded.
Does anyone know what I have to do in order to fix this? Do the search results need their own full view rendered?
Thanks you in advance.
I was mistaken.
The pagination was not linking to the previous result, it was loading everything which the previous result also does, which is why I was mistaken.
I thought that the data provider in the controller kept track of the result set but you have to keep resending the same criteria every time. I was sending the criteria the first time and not on subsequent results so it loaded everything in absence of any constraints. I simply put the search parameters in session and then retrieved them so they could be considered on every request and it fixed the problem.
In short there is no bug, just me being new working with Yii.

Yii - Create items list

is there a simple way of creating a list with editable elements (add/remove) on a page?
Something simillar to the users managing list, where you can add and delete users.
For example, you got a table in DB with 2 columns - "Name" and "Value", and rows like
"Onion"-"10" and "Potato"-"20". The idea is to display the table on a page and make it editable.
Sounds simple but im new in Yii, just yesterday learned about it, did first app and other stuff from guides, but there is no guide how to create things like that manually (so far i was installing widgets mostly)
Thanks
The component you need is CGridView. Take a look to this website.
Yii Playground

Content Query Webpart

I am using content query web part to display pages from pages library.
I want to configure my web part to display pages according to number of page views. most popular page (according to number of views) should be on top. Is it out of the box functionality in SharePoint 2010?
Simple answer: No, this is not included out of the box.
To achieve this, you need to add the number of page views to the page item, then sort by this number by using the Content By Query Web Part. This is not a out-of-the-box solution.
You can show the most popular pages using the rating system, but this is different than basing it on the number of views.

Sitefinity 4.4 - Dynamically change page title and description at runtime

Does anyone know how to dynamically change the page title in Sitefinity from a regular user control?
Our scenario is simple. We have a real estate website with a search feature. On the search results page we have a control showing the search results, but we need to be able to change the Page title, description and keywords based on the search performed.
We posted on Telerik, but they gave vague answers and pointed us to incorrect objects or objects that didn't actually work.
?
Regards,
Jacques
The way I've usually done this in the past is by using an external widget template.
By mapping your widget template to an external file, you can use a full User Control (.ascx file) which means you can also run code behind.
From there it's just a matter of running something like
Page.Title = "whatever";
For more info on using an external template for Sitefinity Widgets, check out this post: http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx
Hope this is helpful!