Access response header data

I use the Radzen IDE to access a Rest Api.
The GET Calls are built to return only paginated results, so there is a server side pagination.
The pagination properties are returned in the response header.

How is it possible to access this, because there is only a partial method for the http request but not for the response in the data source service.

I have about 40-50 entities with its own GET calls. Is there another way to get this information than writing all methods again in a partial class?


There is no way to read the response headers using the default generated methods. There is already partial method to access the HttpRequestMessage sent to the service and we can add another partial method to access the response:

The addition will be available in the next update before the end of the week.

Thanks for the quick response.
That would be great, looking forward to it.

As I think about it, I am confused hot to get the data in my page where I need it.

I thought about creating a class for the pagination data that I fill with the header pagination data in the new partial method.

And add this pagination class as property to my dto models like here, that I can access it in the page where its needed:

But because the result is an IEnumerable this would take a huge overhead because each item would have the pagination result.

Is there a better way how I can use this new partial method to get the pagination info in the page that calls the data source method?


You can read the headers like this in the partial method:

That was how I thought I would do it, but how can I access the pagination properties from the page?
The method of the datasource service that is called from the page will return a IEnumerable<EntityDto>
(This is default generated by using Swagger as datasource)

I think it doesn't make sense to add the Pagination as property to the EntityDto.

The datasource service method needs to return a tuple, doesn't it?

Am I missing something?

It is up to you how you will access that. The service generated by Radzen is a partial class and you can extend it directly in the way you need - for example you can add your own method in the partial class that will wrap the original generated method and will return the data you want.

I tried to pick up your idea with wrapping the datasource method in the partial class, but I couldn't find the new method in the Radzen IDE.

So I tried to recrate this by scratch.

Do I miss something or is this a bug?

Invoke custom method in Blazor server will list only page methods. You can use page partial class to declare and execute the new service method. Invoke data source method will not “see” your custom method since it is not part of the meta code, of course in Radzen 3.0 this will not be a problem.

Ok, thanks. That was my missing link.

I have read somewhere in the forum that Radzen 3.0 shall come maybe in the first quarter of 2022, is this still actual?

We are working hard to release CTP first quarter of 2022, the official Radzen 3.0 will be released later this year.

1 Like