private string CreateScripts(string id, AjaxButtonOptions options)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("$('#");
     sb.Append(id);
     sb.Append("').click(function () {");
     sb.Append(ConvertOption2String(options));
     sb.Append(" });");
     return sb.ToString();
 }
        private string ConvertOption2String(AjaxButtonOptions options)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("$.ajax({");
            sb.AppendFormat("url:'{0}',", options.Url);
            sb.AppendFormat("cache:{0},", options.Cache.ToString().ToLower());
            sb.AppendFormat("type:'{0}',", options.HttpMethod);
            sb.AppendFormat("dataType:'{0}',", options.DataType);
            sb.AppendFormat("data:'{0}',", "name=rand");
            sb.AppendFormat("complete:{0},", "function (data) {alert('ajax complete:'+data); }");

            sb.Append("});");
            return sb.ToString();
        }
 public AjaxButtonComponent(ViewContext viewContext)
     : base(viewContext)
 {
     Options = new AjaxButtonOptions();
 }