How to Obtain Telerik.Web.UI Version Number Programmatically?
How to
Obtain the version number of the currently referenced Telerik.Web.UI dll or another assembly referenced in your project.
Description
Sample ASPX page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
<asp:Label id="ProductVersion1" runat="server" />
</form>
</body>
</html>
Code-behind logic
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Get the file version.
System.Diagnostics.FileVersionInfo myFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(Server.MapPath("~/Bin/Telerik.Web.UI.dll"));
// Print the file name and version number.
ProductVersion1.Text = "File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion;
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim myFileVersionInfo As System.Diagnostics.FileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(Server.MapPath("~/Bin/Telerik.Web.UI.dll"))
ProductVersion1.Text = "File: " & myFileVersionInfo.FileDescription & vbLf & "Version number: " & myFileVersionInfo.FileVersion
End If
End Sub
The result: