GetScreenSize(string userAgent)

1 Answer 55 Views
Grid
Kjell
Top achievements
Rank 1
Iron
Kjell asked on 24 Jan 2023, 12:35 PM

What I understand GetScreenDimensions(string userAgent) return 0 If there is no match.

What return GetScreenSize(string userAgent)  If there is no match? 

 

        Dim screenSize As DeviceScreenSize = Detector.GetScreenSize(Request.UserAgent)
        If Not screenSize = ?????

 

And is Telerik.Web.Device.Detection still developing?

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 27 Jan 2023, 12:36 PM

Hi Kjell,

 

Correct, the GetScreenDimensions() method returns 0 if there is no match for the user agent.

 

The GetScreenSize() method returns an enum "DeviceScreenSize"

Public Enum DeviceScreenSize
    Small
    Medium
    Large
    ExtraLarge
End Enum

 

If there is no match, a new Enum will be returned in every case. You will need to write conditions with the Enum values.

Dim screenSize As DeviceScreenSize = Detector.GetScreenSize(Request.UserAgent)

If screenSize = DeviceScreenSize.Small Then

ElseIf screenSize = DeviceScreenSize.Medium Then

ElseIf screenSize = DeviceScreenSize.Large Then

Else ' else if it is ExtraLarge

End If

 

The Device detection is currently not under development. 

 

Regards,
Attila Antal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Kjell
Top achievements
Rank 1
Iron
Answers by
Attila Antal
Telerik team
Share this question
or