Click here to Skip to main content
15,896,480 members

Comments by sumit kausalye (Top 67 by date)

sumit kausalye 12-Mar-14 3:51am View    
sir i wanted to try this same logic earlier but i don't get e.RowIndex value in button click event. so i am not getting value of particular image.
sumit kausalye 12-Mar-14 3:41am View    
i have done as you said but the problem is i am not getting the path.i guess this is because when i click on delete button the image is not getting selected so i am not getting the path of any particular image. what should i do to select the image?

And when i copied your code it gives me error
on this line
ImageButton img = (ImageButton)e.Item.FindControl("Image1");

because it is giving error to Item.


sumit kausalye 8-Feb-14 0:10am View    
protected void AjaxFileUpload1_OnUploadComplete(object sender, AjaxFileUploadEventArgs file)
{

string name = file.FileName;

if (file.ContentType.Contains("png") || file.ContentType.Contains("PNG") || file.ContentType.Contains("jpg") || file.ContentType.Contains("JPG") || file.ContentType.Contains("jpeg") || file.ContentType.Contains("JPEG") || file.ContentType.Contains("bmp") || file.ContentType.Contains("BMP") || file.ContentType.Contains("gif") || file.ContentType.Contains("GIF"))
{
BindimageTest(name);
}
// Video Extension
// else if (ext == ".wmv" || ext == ".WMV" || ext == ".flv" || ext == ".FLV" || ext == ".avi" || ext == ".AVI" || ext == ".mp4" || ext == ".MP4" || ext == ".MPEG-4" || ext == ".mpeg-4" || ext == ".WMA" || ext == ".wma ")
else if (file.ContentType.Contains("wmv") || file.ContentType.Contains("WMV") || file.ContentType.Contains("flv") || file.ContentType.Contains("FLV") || file.ContentType.Contains("avi") || file.ContentType.Contains("AVI") || file.ContentType.Contains("wma") || file.ContentType.Contains("WMA") || file.ContentType.Contains("mp4") || file.ContentType.Contains(".MP4") || file.ContentType.Contains("MPEG-4") || file.ContentType.Contains("mpeg-4"))
{
BindVideoTest(name);
}
}
sumit kausalye 8-Feb-14 0:09am View    
Deleted
private void BindimageTest(string name)
{

string GallaryPath = "Gallary";
DirectoryInfo gallary = new DirectoryInfo(Server.MapPath("") + "/Gallary/");

bool isgallary = System.IO.Directory.Exists(Server.MapPath(GallaryPath));
if (!isgallary)
{
gallary.Create();
DirectoryInfo thisFolder = new DirectoryInfo(Server.MapPath("") + "/Gallary/" + txtalbum.Text);

bool isExists = System.IO.Directory.Exists(Server.MapPath("") + "\\Gallary\\" + txtalbum.Text);
//if the folder is available or not, if folder is not availble then create folder according to path
if (!isExists)
{
thisFolder.Create();
DirectoryInfo imageFolder = new DirectoryInfo(Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images");


bool isImg = System.IO.Directory.Exists(Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images");
if (!isImg)
{
imageFolder.Create();
string imglocation = Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images/" +name;
AjaxFileUpload1.SaveAs(Server.MapPath("~/Gallary/" + txtalbum.Text + "/Images/" + name), true);
createimagesxml();

}
}
else
{
DirectoryInfo imageFolder = new DirectoryInfo(Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images");
string Imgpath = "/Gallary/" + txtalbum.Text + "/Images";

bool isImg = System.IO.Directory.Exists(Server.MapPath(Imgpath));
if (!isImg)
{
imageFolder.Create();
string imglocation = Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images/" +name;
AjaxFileUpload1.SaveAs(Server.MapPath("~/Gallary/" + txtalbum.Text + "/Images/" + name), true);
createimagesxml();

}
// If Images folder already exists
else
{

string imglocation = Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images/";
if (string.IsNullOrEmpty(imglocation))
{
string img = Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images/" +name;
AjaxFileUpload1.SaveAs(Server.MapPath("~/Gallary/" + txtalbum.Text + "/Images/" + name), true);
createimagesxml();
}
else
{
string img = Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images/" + name;
AjaxFileUpload1.SaveAs(Server.MapPath("~/Gallary/" + txtalbum.Text + "/Images/" + name), true);
// updateimagesxml();
createimagesxml();
}
}
}
}
//if Gallary folder already exists... then check if image folder is present or not
else
{
DirectoryInfo thisFolder = new DirectoryInfo(Server.MapPath("") + "/Gallary/" + txtalbum.Text);

bool isExists = System.IO.Directory.Exists(Server.MapPath("") + "\\Gallary\\" + txtalbum.Text);
//if the folder is available or not, if folder is not availble then create folder according to path
if (!isExists)
{
thisFolder.Create();
DirectoryInfo imageFolder = new DirectoryInfo(Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images");
string Imgpath = txtalbum.Text + "/Images";

bool isImg = System.IO.Directory.Exists(Server.MapPath("~/Gallary/") + txtalbum.Text + "/Images");
if (!isImg)
{
imageFolder.Create();
string imglocation = Server.MapPath("~/Gallary/") + txtalbum.Text
sumit kausalye 8-Feb-14 0:06am View    
<table>
<tr>
<td class="style2">
<asp:Label ID="Label1" runat="server" Text="Create Album : ">
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server">
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label2" runat="server" Text="Upload File :">
</td>
<th>
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" ThrobberID="myThrobber" ContextKeys="fred" MaximumNumberOfFiles="50" runat="server" Width="421px" OnUploadComplete="AjaxFileUpload1_OnUploadComplete" OnClientUploadComplete="uploadComplete" OnClientUploadCompleteAll="onClientUploadCompleteAll" OnUploadCompleteAll="AjaxFileUpload1_UploadCompleteAll" OnUploadStart="AjaxFileUpload1_UploadStart" önClientUploadStart="onClientUploadStart"/>
</th>
</tr>
<tr>
<th colspan="2">
<%-- <asp:Button ID="btnsave" runat="server" Text="SAVE" OnClick="btnsave_Click" />--%>
</th>
</tr>
</table>


sorry i send wrong design earlier sorry for that.. but still it is giving me "".