Full Source – Multi – Language Application in ASP.NET MVC Or Web App

Load data to DropDownList in Asp.net MVC

Today, i will introduce to you how to display data to dropdownlist easiest. You can fill data to dropdownlist and seleted one item before display

@Html.DropDownList and @Html.DropDownListFor in asp.net MVC. You can display list item for user select data

Now you need initialization data for dropdownlist at server as follows:

public ActionResult Index()
        {
            List<SelectListItem> items=new List<SelectListItem>();
            items.Add(new SelectListItem(){Text = "English",Value = "en-us",Selected = false});
            items.Add(new SelectListItem() { Text = "Viet Namese", Value = "vi-vn", Selected = true });
            items.Add(new SelectListItem() { Text = "French", Value = "fr-fr", Selected = false });
            ViewData["listlanguages"] = items;
            return View();
        }

In CSHTML you can call

@Html.DropDownList("langid", (IEnumerable<SelectListItem>)ViewData["listlanguages"])

Get Album and Image (All) from Picasa- C#-Full source

Now i want to use upload my image to picasa, i saw this example very good, i want sharing for everbody. Following full source code, you can get now.

download-source-code_btn1

 

private void BindAlbum()
    {
        AlbumQuery query = new AlbumQuery(PicasaQuery.CreatePicasaUri(txtUserName.Text));
        PicasaService service = new PicasaService("sample");
        service.setUserCredentials(txtUserName.Text, txtpwd.Text);
        Session["token"] = service.QueryClientLoginToken();
        PicasaFeed feed = service.Query(query);
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("Album", typeof(string)));
        dt.Columns.Add(new DataColumn("NO of photo", typeof(string)));
        dt.Columns.Add(new DataColumn("url", typeof(string)));
        dt.Columns.Add(new DataColumn("id", typeof(string)));
        foreach (PicasaEntry entry in feed.Entries)
        {
            DataRow dr1 = dt.NewRow();
            AlbumAccessor ac = new AlbumAccessor(entry);
            dr1["Album"] = entry.Title.Text;
            dr1["NO of photo"] = ac.NumPhotos;
            dr1["id"] = ac.Id;
            dr1["url"] = entry.Media.Thumbnails[0].Url;
            dt.Rows.Add(dr1);
        }
        ds.Tables.Add(dt);
        ViewState["Album"] = ds;
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
 
    /// <summary>
    /// this event used to bind the photo to gallery using the albumid
    /// </summary>
 
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Download")
        {
            Panel1.Visible = true;
            PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri(txtUserName.Text, e.CommandArgument.ToString()));
            PicasaService service = new PicasaService("Picasa");
            service.setUserCredentials(hfUsername.Value, hfPwd.Value);
            PicasaFeed feed = service.Query(query);
            StringBuilder html = new StringBuilder();
            string title;
            html.Append("<ul class=\"thumbs noscript\">");
            foreach (PicasaEntry entry in feed.Entries)
            {
                if (entry.Title.Text.LastIndexOf(".") > -1)
                    title = entry.Title.Text.Substring(0, entry.Title.Text.LastIndexOf("."));
                else
                    title = entry.Title.Text;
 
                html.Append(String.Format("<li><a class=\"thumb\" name={0} href=\"{1}\" title=\"{2}\"><img src=\"{3}\" alt=\"{4}\"/></a>",
                    title, entry.Media.Content.Url, title, entry.Media.Thumbnails[0].Url, title));
                html.Append(String.Format("<div class=\"caption\"><div class=\"image-title\">{0}</div><div class=\"image-desc\">{1}</div></div></li>",
                    title, entry.Summary.Text));
 
            }
            html.Append("</ul>");
            divSlider.InnerHtml = html.ToString();
        }
    }

Best gen Barcode winform and webform-Full source

Best-Code-barcode-Dotnet-Code-Full-source

I am tested for my project, and this is barcde very good

Click create barcode:

private void btnEncode_Click(object sender, EventArgs e)
        {
            int W = Convert.ToInt32(this.txtWidth.Text.Trim());
            int H = Convert.ToInt32(this.txtHeight.Text.Trim());
 
            BarcodeLib.TYPE type = BarcodeLib.TYPE.UNSPECIFIED;
            switch (cbEncodeType.SelectedItem.ToString().Trim())
            {
                case "UPC-A": type = BarcodeLib.TYPE.UPCA; break;
                case "UPC-A (Numbered)": type = BarcodeLib.TYPE.UPCA; break;
                case "UPC-E": type = BarcodeLib.TYPE.UPCE; break;
                case "UPC 2 Digit Ext.": type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_2DIGIT; break;
                case "UPC 5 Digit Ext.": type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_5DIGIT; break;
                case "EAN-13": type = BarcodeLib.TYPE.EAN13; break;
                case "JAN-13": type = BarcodeLib.TYPE.JAN13; break;
                case "EAN-8": type = BarcodeLib.TYPE.EAN8; break;
                case "ITF-14": type = BarcodeLib.TYPE.ITF14; break;
                case "Codabar": type = BarcodeLib.TYPE.Codabar; break;
                case "PostNet": type = BarcodeLib.TYPE.PostNet; break;
                case "Bookland/ISBN": type = BarcodeLib.TYPE.BOOKLAND; break;
                case "Code 11": type = BarcodeLib.TYPE.CODE11; break;
                case "Code 39": type = BarcodeLib.TYPE.CODE39; break;
                case "Code 39 Extended": type = BarcodeLib.TYPE.CODE39Extended; break;
                case "Code 93": type = BarcodeLib.TYPE.CODE93; break;
                case "LOGMARS": type = BarcodeLib.TYPE.LOGMARS; break;
                case "MSI": type = BarcodeLib.TYPE.MSI_Mod10; break;
                case "Interleaved 2 of 5": type = BarcodeLib.TYPE.Interleaved2of5; break;
                case "Standard 2 of 5": type = BarcodeLib.TYPE.Standard2of5; break;
                case "Code 128": type = BarcodeLib.TYPE.CODE128; break;
                case "Code 128-A": type = BarcodeLib.TYPE.CODE128A; break;
                case "Code 128-B": type = BarcodeLib.TYPE.CODE128B; break;
                case "Code 128-C": type = BarcodeLib.TYPE.CODE128C; break;
                default: MessageBox.Show("Please specify the encoding type."); break;
            }//switch
 
            try
            {
                if (type != BarcodeLib.TYPE.UNSPECIFIED)
                {
                    b.IncludeLabel = this.chkGenerateLabel.Checked;
 
                    //===== Encoding performed here =====
                    barcode.Image = b.Encode(type, this.txtData.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor, W, H);
                    //===================================
 
                    //===== Static Encoding performed here =====
                    //barcode.Image = BarcodeLib.Barcode.DoEncode(type, this.txtData.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor);
                    //==========================================
 
                    txtEncoded.Text = b.EncodedValue;
 
                    barcode.Width = barcode.Image.Width;
                    barcode.Height = barcode.Image.Height;
 
                    tsslEncodedType.Text = "Encoding Type: " + b.EncodedType.ToString();
                }//if
 
                barcode.Width = barcode.Image.Width;
                barcode.Height = barcode.Image.Height;
 
                //reposition the barcode image to the middle
                barcode.Location = new Point((this.groupBox2.Location.X + this.groupBox2.Width / 2) - barcode.Width / 2, (this.groupBox2.Location.Y + this.groupBox2.Height / 2) - barcode.Height / 2);
 
            }//try
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }//catch
        }//btnEncode_Click

Save barcode to image

private void btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "BMP (*.bmp)|*.bmp|GIF (*.gif)|*.gif|JPG (*.jpg)|*.jpg|PNG (*.png)|*.png|TIFF (*.tif)|*.tif";
            sfd.AddExtension = true;
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                BarcodeLib.SaveTypes savetype = BarcodeLib.SaveTypes.UNSPECIFIED;
                switch (sfd.FilterIndex)
                {
                    case 1: /* BMP */  savetype = BarcodeLib.SaveTypes.BMP; break;
                    case 2: /* GIF */  savetype = BarcodeLib.SaveTypes.GIF; break;
                    case 3: /* JPG */  savetype = BarcodeLib.SaveTypes.JPG; break;
                    case 4: /* PNG */  savetype = BarcodeLib.SaveTypes.PNG; break;
                    case 5: /* TIFF */ savetype = BarcodeLib.SaveTypes.TIFF; break;
                    default: break;
                }//switch
                b.SaveImage(sfd.FileName, savetype);
            }//if
        }//btnSave_Click

download-source-code_btn1

Code Upload FTP C# – Upload file to server-Full

Just I am  completed my project winform, to working with file excel (over 30MB), i can not process at client, i must upload to server and process data.

I would like to share the following with you code upload to server

  • ftpServerIP: address to server 192.168.2.36
  • ftpUserID: Username to access server
  • ftpPassword: password ftp
  • pathFilename: path file at client (ex: E:\xxx12.xls)
private bool UploadFTP(string ftpServerIP, string ftpUserID, string ftpPassword, string pathFilename)
        {
            try
            {
                FileInfo fileInf = new FileInfo(pathFilename);
                string uri = "ftp://" + ftpServerIP + "/" + fileInf.Name;
                FtpWebRequest reqFTP;
 
                // Create FtpWebRequest object from the Uri provided
                reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileInf.Name));
 
                // Provide the WebPermission Credintials
                reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
 
                // By default KeepAlive is true, where the control connection is not closed
                // after a command is executed.
                reqFTP.KeepAlive = false;
 
                // Specify the command to be executed.
                reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
 
                // Specify the data transfer type.
                reqFTP.UseBinary = true;
 
                // Notify the server about the size of the uploaded file
                reqFTP.ContentLength = fileInf.Length;
 
                // The buffer size is set to 2kb
                int buffLength = 2048;
                byte[] buff = new byte[buffLength];
                int contentLen;
 
                // Opens a file stream (System.IO.FileStream) to read the file to be uploaded
                FileStream fs = fileInf.OpenRead();
 
                try
                {
                    // Stream to which the file to be upload is written
                    Stream strm = reqFTP.GetRequestStream();
 
                    // Read from the file stream 2kb at a time
                    contentLen = fs.Read(buff, 0, buffLength);
 
                    // Till Stream content ends
                    while (contentLen != 0)
                    {
                        // Write Content from the file stream to the FTP Upload Stream
                        strm.Write(buff, 0, contentLen);
                        contentLen = fs.Read(buff, 0, buffLength);
                    }
 
                    // Close the file stream and the Request Stream
                    strm.Close();
                    fs.Close();
                    return true;
                }
                catch (Exception ex)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Upload Error");
                }
            }
            catch (Exception)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show("Upload To Server Error");
            }
 
            return false;
        }

Easy File Transfer with Files 4 Client Pro-Demo and buy cheap

easy-file-transfer-with-files-4-client-pro-demo-and-buy-cheap

With Easy File Transfer Files 4 Client Pro: Upload your files directly inside the brower and share them Presents your files and folders in a well-arranged list Slick design available in any color Brand it for your name and logo Drag and drop upload supported Easy and fast in browser setup Direct Download Link: Files […]

Continue reading...

How to Customize the Genesis Footer

Custom Footer of Genesis, theme geneis

Continue reading...

Show image from byte array in .net MVC

1. Code CSharp To do not show path image, you can encryt base 64 and display 2. Code HTML: Happy coding

Continue reading...

Download: The Practice – Lawyer, Legal Offices HTML Theme

Download: The Practice - Lawyer, Legal Offices HTML Theme

1. Introduction: WordPress theme The Practice is a responsive, clean and stark looking, lawyer HTML theme specifically designed and developed to meet the needs of attorneys, legal offices, consultancy firms and many others that need a corporate website. With a responsive layout and fluid grid, The Practice handles all devices and screen resolutions with ease. […]

Continue reading...

Download: HomeQuest – Real Estate HTML Theme

Download: HomeQuest - Real Estate HTML Theme

Introduction: WordPress theme HomeQuest Built to cater to real estate agencies, brokers and directories. With a responsive layout and fluid grid, HomeQuest  handles all devices and screen resolutions with ease. HomeQuest HTML has a pixel perfect design and a bunch of features that will make clients call again and again. We have also added some handy […]

Continue reading...

Download: Unite Gallery – Multipurpose JQuery Gallery

Download: Unite Gallery - Multipurpose JQuery Gallery

The Unite Gallery is multipurpose javascript gallery based on jquery library. It’s built with a modular technique with a lot of accent of ease of use and customization. It’s very easy to customize the gallery, changing it’s skin via css, and even writing your own theme. Features Unite Gallery – Multipurpose JQuery Gallery: Responsive – […]

Continue reading...