本文整理匯總了C#中AjaxControlToolkit.GetContents方法的典型用法代碼示例。如果您正苦於以下問題:C# AjaxControlToolkit.GetContents方法的具體用法?C# AjaxControlToolkit.GetContents怎麽用?C# AjaxControlToolkit.GetContents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AjaxControlToolkit
的用法示例。
在下文中一共展示了AjaxControlToolkit.GetContents方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ajaxFileUpload_OnUploadComplete
protected void ajaxFileUpload_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
if(e.ContentType.Contains("jpg") || e.ContentType.Contains("gif")
|| e.ContentType.Contains("png") || e.ContentType.Contains("jpeg")) {
Session["fileContentType_" + e.FileId] = e.ContentType;
Session["fileContents_" + e.FileId] = e.GetContents();
}
// Set PostedUrl to preview the uploaded file.
e.PostedUrl = string.Format("?preview=1&fileId={0}", e.FileId);
}
示例2: UploadComplete
protected void UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
try
{
Account account = new Account("dlyvxs7of", "634626974285569", "FtB_0jhcmFypFS7QTwCBKcPRGzE");
Cloudinary cloudinary = new Cloudinary(account);
ImageUploadParams uploadParams = new ImageUploadParams()
{
File = new FileDescription("file", new MemoryStream(e.GetContents()))
};
ImageUploadResult uploadResult = cloudinary.Upload(uploadParams);
HEWDataContext context = new HEWDataContext();
context.ProjectsImages.InsertOnSubmit(new ProjectsImage
{ImgPublicID = uploadResult.PublicId, ProjectID = int.Parse(Request.QueryString["ProjectID"])});
context.SubmitChanges();
}
catch (Exception)
{
}
}
示例3: saveImage
protected void saveImage(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string tempPath = System.IO.Path.GetTempPath();
System.Drawing.Image img = new GUIHelper().byteArrayToImage(e.GetContents());
if (Session["fileContentType_"] == null)
{
Session.Add(("fileContentType_"), e.ContentType);
}
Session["fileContentType_"] = e.ContentType;
if (Session["fileContents_"] == null)
{
Session.Add("fileContents_", e.GetContents());
}
Session["fileContents_"] = e.GetContents();
string relativePath = Page.AppRelativeVirtualPath;
relativePath = relativePath.Replace("~", "");
e.PostedUrl = String.Format("/HRM" + relativePath + "?preview=1");
}