this.Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "function LogOffFunction() { if (confirm('Are you sure you logoff')) {return true;} else {return false;} }", true);
Button1.Attributes.Add("onclick", "return LogOffFunction()");
Button1.Attributes.Add("onclick", "return LogOffFunction()");