你在你的Page_Load事件中Button1.Attributes.Add("onclick","return confirm('" + 变量值 + "')");就可以了
OnClientClick="return confirm('<%=变量%>')"
楼上正解