tolgasen adlı üyeden alıntı: mesajı görüntüle
public string KontratId = "";

Burada veriyi boş alıyorsunuz. Hatanın sebebi budur.
public string KontratId = Request.QueryString("KontratId").ToString();

şeklinde değişken ile alabilirsiniz.
bu şekilde yaptığımda bu seferde aşağıdaki hatayı alıyorum

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0120: An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.Request.get'

Source Error:


Line 12: {
Line 13:     SiteAyar system = new SiteAyar();
Line 14:     public string KontratId = Request.QueryString("KontratId").ToString();
Line 15: 
Line 16: 


Source File: c:\inetpub\vhosts\xxxxx.net.tr\httpdocs\Admin\Kontratdetay.aspx.cs    Line: 14


Show Detailed Compiler Output:

Show Complete Compilation Source:


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929