Creating details page for an item

Ashutosh Pandey asked on December 6, 2018 13:50

I am new to Kentico and want to figure out the best way to create a details page. I am from ASP.NET background. I need to upload various companies using Excel. For this, I created my custom module with module classes. I designed page for uploading Excel and with Info + Provider classes, able to upload records.

I have a page that lists companies. I used DataList with custom query and able to display data. Each company on the page is a hyperlink pointing to the details page for that company. The link is like this: ( created transformation )

<a href='/company.aspx?id=<%#Eval("id") %>'><%#Eval("name")%>

Now, I need to pick detail of particular company and display column values at various sections of the web page. What should be my approach for this?

  1. Use a query data source, bind to query string parameter 'id'. And how to display?
  2. Use a DataList (will have only one record) with all HTML code in transformation?

or any other way? I hope I am able to explain my question

Thanks

Correct Answer

Brenden Kehren answered on December 6, 2018 20:01

I'd suggest using a wildcard url alias for your /company page. Then your URL will look something like /company/1234, a little more friendly.

Next add a custom query repeater to your page. Generate a query calling your module class data. You will need to create a container page type (one without any fields) which will hold transformations and queries. Create your query in there. Be sure to use the query macros as defined in the custom query documentation. Your query could look like this:

SELECT ##TOPN## ##COLUMNS##
FROM My_CustomModuleTable
WHERE ##WHERE##
ORDER BY ##ORDERBY##

After you have your query created, finish setting up the webpart. In the Where clause, click the arrow to the left of the textbox and enter

ModuleIDColumn = {%ToInt(QueryString.GetValue("ID"))|(default)0|(identity)GlobalAdministrator%}

And of course for the list webpart, you set the operator to == vs. !=

1 votesVote for this answer Unmark Correct answer

Recent Answers


Ashutosh Pandey answered on December 7, 2018 04:33

Thanks Brenden,

So I need to create most of the page design in transformation. And there is no control in Kentico that allows to load single record only.

I'll work with custom repeater then.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 7, 2018 06:30

You'd have 2 repeaters, one for your listing and another for your detail.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.