flajaxian control not working when page contains any control or method.

Apr 27, 2012 at 10:48 AM
Edited Apr 27, 2012 at 10:50 AM

upload.aspx

<table width="100%">
        <tr>
            <td>
                <asp:Panel ID="PForm" runat="server">
                    <table width="100%">
                        <tr>
                            <td class="subnavi" colspan="3">
                                <a href="Default.aspx">Home </a><span style="color: #FE63BB;">»</span> <a href="#">Upload
                                    Photos</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                                <asp:Label ID="lblimg_b" Visible="false" runat="server"></asp:Label>
                                <asp:Label ID="lblimg_s" runat="server" Visible="false"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="120" class="graytext">
                                Category
                            </td>
                            <td width="20" align="center">
                                :
                            </td>
                            <td align="left">
                                <asp:DropDownList CssClass="listmenu" ID="ddlCategory" runat="server" DataSourceID="ObjectDataSource1"
                                    DataTextField="catname" DataValueField="catid">
                                </asp:DropDownList>
                                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
                                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataBy_s_topphotographercategory"
                                    TypeName="picsTableAdapters.jquerySliderTableAdapter" UpdateMethod="Update">
                                    <DeleteParameters>
                                        <asp:Parameter Name="Original_catid" Type="Decimal" />
                                    </DeleteParameters>
                                    <UpdateParameters>
                                        <asp:Parameter Name="catname" Type="String" />
                                        <asp:Parameter Name="Original_catid" Type="Decimal" />
                                    </UpdateParameters>
                                </asp:ObjectDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>
                        <tr>
                            <td align="left" class="graytext">
                                Short Description
                            </td>
                            <td align="center">
                                :
                            </td>
                            <td align="left" valign="middle">
                                <asp:TextBox CssClass="listmenu" ID="txtShortDescription" TextMode="MultiLine" Height="50"
                                    runat="server">
                                </asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="txtShortDescription" ID="RequiredFieldValidator1"
                                    runat="server" ErrorMessage="*">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>
                        <%-- <tr>
                            <td align="left" class="graytext">
                                Upload Image
                            </td>
                            <td align="center">
                                :
                            </td>
                            <td align="left">
                                <asp:FileUpload CssClass="fileupload" ID="fuimage" runat="server" accept="png|jpg" />
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>--%>
                        <tr>
                            <td align="left" class="graytext">
                                show on home page?
                            </td>
                            <td align="center">
                                :
                            </td>
                            <td align="left">
                                <asp:CheckBox ID="chkFav" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>
                        <tr>
                            <td align="left" class="graytext">
                                show on Porfolio?
                            </td>
                            <td align="center">
                                :
                            </td>
                            <td align="left">
                                <asp:CheckBox ID="chkPorfolio" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3" valign="top">
                                <asp:Panel ID="Panel1" runat="server" Visible="false">
                                    <table class="graytext">
                                        <tr>
                                            <td align="left" width="125" class="graytext">
                                                Image Compression
                                            </td>
                                            <td align="center">
                                                :
                                            </td>
                                            <td align="left">
                                                <asp:RadioButtonList ID="rBtnlistSize" runat="server" CssClass="graytext" RepeatDirection="Horizontal">
                                                    <asp:ListItem>0</asp:ListItem>
                                                    <asp:ListItem Selected="True">50</asp:ListItem>
                                                    <asp:ListItem>100</asp:ListItem>
                                                </asp:RadioButtonList>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3" align="left">
                                                <table class="graytext">
                                                    <tr>
                                                        <td colspan="3" align="left" class="graytext">
                                                            Image Compression
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            0%
                                                        </td>
                                                        <td>
                                                            -
                                                        </td>
                                                        <td>
                                                            This will increase your loading time.Not Good For Business.
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <b>50%</b>
                                                        </td>
                                                        <td>
                                                            -
                                                        </td>
                                                        <td>
                                                            <b>Good For Business</b>
                                                        </td>
                                                        <tr>
                                                            <td>
                                                                100%
                                                            </td>
                                                            <td>
                                                                -
                                                            </td>
                                                            <td>
                                                                Not Good For Business.
                                                            </td>
                                                        </tr>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                            </td>
                        </tr>
                        <%--<tr>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td align="left">
                                <asp:ImageButton AlternateText="Save" ID="ImageButton1" runat="server" ImageUrl="~/images/save.jpg"
                                    OnClick="ImageButton1_Click" />
                            </td>
                        </tr>--%>
                        <tr>
                            <td colspan="3">
                                <fjx:FileUploader ID="FileUploader1" runat="server" OnFileReceived="fileUploader_FileReceived">
                                    <Adapters>
                                        <fjx:FileSaverAdapter FolderName="fjximages"></fjx:FileSaverAdapter>
                                    </Adapters>
                                </fjx:FileUploader>
                            </td>
                        </tr>
                        <tr>
                            <td height="10">
                                <asp:Label ID="lMaxUId" runat="server" Visible="false"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Panel ID="PMsg" runat="server" Visible="false">
                    <table>
                        <tr>
                            <td align="center">
                                <asp:Label ID="lMsg" Width="800" Text="Please Wait......." runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <asp:Image AlternateText="Loading" ID="iloading" ImageUrl="images/loading_animation.gif"
                                    runat="server" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
    </table>

 

.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing.Imaging;
using System.Drawing;
using System.Data;

public partial class uploadphoto : System.Web.UI.Page
{
    string fullpath, fullpath1, fullpath2, fullpath3, strLocationOfNewFile,ext;
    protected void Page_Load(object sender, EventArgs e)
    {
        helper.Security();
        if (Request.Cookies["userType"].Value.ToString() == "3")
        {
            Panel1.Visible = true;
        }
        else
        {
            Panel1.Visible = false;
        }
        if (!Page.IsPostBack)
        {
            GetMaxID();
           
        }
    }
    protected void fileUploader_FileReceived(object sender, com.flajaxian.FileReceivedEventArgs e)
    {
        int imgLength = e.File.ContentLength;
        string fileName = e.File.FileName;
        string sExtension = System.IO.Path.GetExtension(e.File.FileName).ToLower();
        using (picsTableAdapters.TestMasterTableAdapter test = new picsTableAdapters.TestMasterTableAdapter())
        {
            test.Insert(fileName, 1);
        }
        //using (knowTableAdapters.TestMasterTableAdapter test = new knowTableAdapters.TestMasterTableAdapter())
        //{
        //    test.Insert(fileName);
        //}
        //watermark(fileName);
    }
    protected void GetMaxID()
    {
        using (picsTableAdapters.maxuidTableAdapter maxuid = new picsTableAdapters.maxuidTableAdapter())
        {
            DataTable Dt=maxuid.GetData();
            try
            {
                if (Dt.Rows.Count > 0)
                {

                    lMaxUId.Text = (Convert.ToInt32(Dt.Rows[0]["maxuid"]) + 1).ToString();
                }
                else
                {
                    lMaxUId.Text = "1";
                }
            }
            catch {
                lMaxUId.Text = "1";
            }
           
        }
   
    }
   
    protected void watermark(string filename)
    {


                string b = filename;
                ext = Path.GetExtension(filename);
                ext = ext.ToLower();
                if ((ext == ".jpg") || (ext == ".png") || (ext == ".jpeg") || (ext == ".gif"))
                {
                    PForm.Visible = false;
                    PMsg.Visible = true;
                    using (picsTableAdapters.UPLOADSTableAdapter UPLOADS = new picsTableAdapters.UPLOADSTableAdapter())
                    {
                        if (chkFav.Checked == true)
                        {
                            UPLOADS.insert(Convert.ToInt32(ddlCategory.SelectedValue), Convert.ToDecimal(Request.Cookies["userId"].Value), "images/category/thumb/" + lMaxUId.Text + ext, "original/" + lMaxUId.Text + ext, "HEading", txtShortDescription.Text, "Details", Convert.ToDecimal(0), Convert.ToDecimal(0), DateTime.Now, null, null, null, true, chkFav.Checked, Convert.ToInt32(Request.Cookies["userType"].Value), false, null, false, null, "images/category/top4/" + lMaxUId.Text + ext, false, chkPorfolio.Checked);
                        }
                        else
                        {
                            UPLOADS.insert(Convert.ToInt32(ddlCategory.SelectedValue), Convert.ToDecimal(Request.Cookies["userId"].Value), "images/category/thumb/" + lMaxUId.Text + ext, "original/" + lMaxUId.Text + ext, "HEading", txtShortDescription.Text, "Details", Convert.ToDecimal(0), Convert.ToDecimal(0), DateTime.Now, null, null, null, true, chkFav.Checked, Convert.ToInt32(Request.Cookies["userType"].Value), false, null, false, null, "images/category/top4/" + lMaxUId.Text + ext, null, chkPorfolio.Checked);
                        }

                    }

                    //strLocationOfNewFile = Server.MapPath("~/Images/Upload/SMALL/" +b);
                    fullpath = Server.MapPath("~/temp/" + lMaxUId.Text + ext);
                    fullpath1 = Server.MapPath("~/temp/c" + lMaxUId.Text + ext);
                    fullpath2 = Server.MapPath("~/temp/d" + lMaxUId.Text + ext);
                    fullpath3 = Server.MapPath("~/temp/e" + lMaxUId.Text + ext);
                   // fuimage.SaveAs(fullpath);


                    //Store Thumb Image for home page
                    strLocationOfNewFile = Server.MapPath("~/Images/category/thumb/" + lMaxUId.Text + ext);
                    Compress.ResizeImage(fullpath, fullpath1, 117, 89);
                    Compress.VaryQualityLevel(fullpath1, strLocationOfNewFile, Convert.ToInt32(rBtnlistSize.SelectedValue));
                    //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
                    File.Delete(fullpath1);
                    //File.Delete(fullpath2);
                    File.Delete(fullpath3);


                    //Store Top 4 Category of home page
                    strLocationOfNewFile = Server.MapPath("~/Images/category/top4/" + lMaxUId.Text + ext);
                    Compress.ResizeImage(fullpath, fullpath1, 226, 89);
                    Compress.VaryQualityLevel(fullpath1, strLocationOfNewFile, Convert.ToInt32(rBtnlistSize.SelectedValue));
                    //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
                    File.Delete(fullpath1);
                    File.Delete(fullpath2);
                    File.Delete(fullpath3);


                    //Store large Image
                    strLocationOfNewFile = Server.MapPath("~/original/" + lMaxUId.Text + ext);
                    //Compress.ResizeImage(fullpath, fullpath1, 500,400);
                    //Compress.VaryQualityLevel(fullpath1, fullpath2, Convert.ToInt32(rBtnlistSize.SelectedValue));
                    //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
                    Compress.AddWatermark(fullpath, strLocationOfNewFile, 1);
                    File.Delete(fullpath1);
                    //File.Delete(fullpath2);
                    File.Delete(fullpath3);


                    lMsg.Visible = true;
                    lMsg.Text = "Please wait..";
                    lMsg.CssClass = "green";
                    txtShortDescription.Text = "";
                    helper.likes();
                    HttpResponse.RemoveOutputCacheItem("/picslike/member.aspx");
                    Response.AddHeader("REFRESH", "1;URL=Member.aspx");

                }
                else
                {
                    lMsg.Visible = true;
                    lMsg.Text = "Please Select Image";
                    lMsg.CssClass = "red";
                    txtShortDescription.Text = "";
                }

          
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
    //    if (fuimage.HasFile)
    //    {
    //        try
    //        {
              
    //            string b = fuimage.FileName;
    //            ext = Path.GetExtension(fuimage.FileName);
    //            ext = ext.ToLower();
    //            if ((ext == ".jpg") || (ext == ".png") || (ext == ".jpeg") || (ext == ".gif"))
    //            {
    //                PForm.Visible = false;
    //                PMsg.Visible = true;
    //                using (picsTableAdapters.UPLOADSTableAdapter UPLOADS = new picsTableAdapters.UPLOADSTableAdapter())
    //                {
    //                    if (chkFav.Checked == true)
    //                    {
    //                        UPLOADS.insert(Convert.ToInt32(ddlCategory.SelectedValue), Convert.ToDecimal(Request.Cookies["userId"].Value), "images/category/thumb/" + lMaxUId.Text + ext, "original/" + lMaxUId.Text + ext, "HEading", txtShortDescription.Text, "Details", Convert.ToDecimal(0), Convert.ToDecimal(0), DateTime.Now, null, null, null, true, chkFav.Checked, Convert.ToInt32(Request.Cookies["userType"].Value), false, null, false, null, "images/category/top4/" + lMaxUId.Text + ext, false, chkPorfolio.Checked);
    //                    }
    //                    else
    //                    {
    //                        UPLOADS.insert(Convert.ToInt32(ddlCategory.SelectedValue), Convert.ToDecimal(Request.Cookies["userId"].Value), "images/category/thumb/" + lMaxUId.Text + ext, "original/" + lMaxUId.Text + ext, "HEading", txtShortDescription.Text, "Details", Convert.ToDecimal(0), Convert.ToDecimal(0), DateTime.Now, null, null, null, true, chkFav.Checked, Convert.ToInt32(Request.Cookies["userType"].Value), false, null, false, null, "images/category/top4/" + lMaxUId.Text + ext, null, chkPorfolio.Checked);
    //                    }
                       
    //                }

    //                //strLocationOfNewFile = Server.MapPath("~/Images/Upload/SMALL/" +b);
    //                fullpath = Server.MapPath("~/temp/" + lMaxUId.Text + ext);
    //                fullpath1 = Server.MapPath("~/temp/c" + lMaxUId.Text + ext);
    //                fullpath2 = Server.MapPath("~/temp/d" + lMaxUId.Text + ext);
    //                fullpath3 = Server.MapPath("~/temp/e" + lMaxUId.Text + ext);
    //                fuimage.SaveAs(fullpath);


    //                //Store Thumb Image for home page
    //                strLocationOfNewFile = Server.MapPath("~/Images/category/thumb/" + lMaxUId.Text + ext);
    //                Compress.ResizeImage(fullpath, fullpath1, 117, 89);
    //                Compress.VaryQualityLevel(fullpath1, strLocationOfNewFile, Convert.ToInt32(rBtnlistSize.SelectedValue));
    //                //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
    //                File.Delete(fullpath1);
    //                //File.Delete(fullpath2);
    //                File.Delete(fullpath3);


    //                //Store Top 4 Category of home page
    //                strLocationOfNewFile = Server.MapPath("~/Images/category/top4/" + lMaxUId.Text + ext);
    //                Compress.ResizeImage(fullpath, fullpath1, 226, 89);
    //                Compress.VaryQualityLevel(fullpath1, strLocationOfNewFile, Convert.ToInt32(rBtnlistSize.SelectedValue));
    //                //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
    //                File.Delete(fullpath1);
    //                File.Delete(fullpath2);
    //                File.Delete(fullpath3);


    //                //Store large Image
    //                strLocationOfNewFile = Server.MapPath("~/original/" + lMaxUId.Text + ext);
    //                //Compress.ResizeImage(fullpath, fullpath1, 500,400);
    //                //Compress.VaryQualityLevel(fullpath1, fullpath2, Convert.ToInt32(rBtnlistSize.SelectedValue));
    //                //Compress.AddWatermark(fullpath2, strLocationOfNewFile, 1);
    //                Compress.AddWatermark(fullpath, strLocationOfNewFile, 1);
    //                File.Delete(fullpath1);
    //                //File.Delete(fullpath2);
    //                File.Delete(fullpath3);


    //                lMsg.Visible = true;
    //                lMsg.Text = "Please wait..";
    //                lMsg.CssClass = "green";
    //                txtShortDescription.Text = "";
    //                helper.likes();
    //                HttpResponse.RemoveOutputCacheItem("/picslike/member.aspx");
    //                Response.AddHeader("REFRESH", "1;URL=Member.aspx");

    //            }
    //            else
    //            {
    //                lMsg.Visible = true;
    //                lMsg.Text = "Please Select Image";
    //                lMsg.CssClass = "red";
    //                txtShortDescription.Text = "";
    //            }

    //        }
    //        catch
    //        {
    //            lMsg.Visible = true;
    //            lMsg.Text = "Please try again later...!!!";
    //            lMsg.CssClass = "red";
    //            txtShortDescription.Text = "";
    //        }


    //    }
    //    else
    //    {
    //        lMsg.Visible = true;
    //        lMsg.Text = "Please Select Image ";
    //        lMsg.CssClass = "red";
    //    }
       
    }
}

Kindly give me reply.