hi all :)
I have a grid with template column, Item mode is a binary Image, and edit mode is a rad upload
how can I get the file name and make it an insert parameter default value ?
here is my code
HTML
C#.net
thank you all :)
I have a grid with template column, Item mode is a binary Image, and edit mode is a rad upload
how can I get the file name and make it an insert parameter default value ?
here is my code
HTML
<telerik:GridTemplateColumn DataField="Data" HeaderText="Image" UniqueName="Upload"> <ItemTemplate> <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" ImageUrl='<%# Eval("User_AvatarPath") %>' AutoAdjustImageControlSize="false" Height="80px" Width="80px" /> </ItemTemplate> <EditItemTemplate> <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="OnClientFileUploaded" AllowedFileExtensions="jpg,jpeg,png,gif" MaxFileSize="1048576" OnValidatingFile="RadAsyncUpload1_ValidatingFile" TargetFolder="~/Pic's/Users" OverwriteExistingFiles="false" > </telerik:RadAsyncUpload> </EditItemTemplate></telerik:GridTemplateColumn>C#.net
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Telerik.Charting;using Telerik.Web.UI;using System.Data.SqlClient;public partial class HTKfjksh7869435fds435_ljagut32542GSDFG_lgjdfsh32452GR235GGOJA324_Contros_NewItem_WebUserControl : System.Web.UI.UserControl{ protected void Page_Load(object sender, EventArgs e) { SqlDataSource1.UpdateParameters["User_AvatarPath"].DefaultValue = _ImagePath; SqlDataSource1.InsertParameters["User_AvatarPath"].DefaultValue = _ImagePath; } const int MaxTotalBytes = 1048576; // 1 MB int totalBytes; private static string _ImageName = ""; private static string _ImagePath = "~/Pic's/Users/" + _ImageName; public bool? IsRadAsyncValid { get { if (Session["IsRadAsyncValid"] == null) { Session["IsRadAsyncValid"] = true; } return Convert.ToBoolean(Session["IsRadAsyncValid"].ToString()); } set { Session["IsRadAsyncValid"] = value; } } public void RadAsyncUpload1_ValidatingFile(object sender, Telerik.Web.UI.Upload.ValidateFileEventArgs e) { if ((totalBytes < MaxTotalBytes) && (e.UploadedFile.ContentLength < MaxTotalBytes)) { e.IsValid = true; totalBytes += e.UploadedFile.ContentLength; IsRadAsyncValid = true; _ImageName = e.UploadedFile.GetName(); } else { e.IsValid = false; IsRadAsyncValid = false; } }}thank you all :)