วันพฤหัสบดีที่ 26 กุมภาพันธ์ พ.ศ. 2558

elfinder Browser file use getFileCallback [worked]

2 ความคิดเห็น:

elfinder Browser file use getFileCallback

//html
        
        
//script
$('#select-button').click(function () {
                var f = $('#elfinder').elfinder({
                    url: '/connector', // connector route defined in \App_Start\RouteConfig.cs
                    lang: 'en',
                    onlyMimes: ["image"], // display all images
                    customData: { folder: "teacher", subFolder: null },
                    height: 490,
                    docked: false,
                    dialog: { width: 400, modal: true },
                    closeOnEditorCallback: true,
                    getFileCallback: function (url) {
                        console.log(url.url);
                        $('#new_file').val(url.url);
                        // CLOSE ELFINDER HERE
                        $('#elfinder').remove();  //remove Elfinder
                        location.reload();   //reload Page for second selection
                    }
                }).elfinder('instance');
            });
});
link: http://stackoverflow.com/questions/20400817/close-elfinder-programatically-after-file-selection?answertab=active#tab-top

Read More

วันจันทร์ที่ 16 กุมภาพันธ์ พ.ศ. 2558

c# Grade Calculator (Using List Object)

ไม่มีความคิดเห็น:

//Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GradeCalculatorUsingListObject
{
    class Program
    {
        static void Main(string[] args)
        {
            //add list Grade
            List ls = new List();
            ls.Add(new Grades(49f, "F"));
            ls.Add(new Grades(49.5f, "D"));
            ls.Add(new Grades(55f, "D+"));
            ls.Add(new Grades(60f, "C"));
            ls.Add(new Grades(65f, "P"));
            ls.Add(new Grades(70f, "B"));
            ls.Add(new Grades(75f, "B+"));
            ls.Add(new Grades(80f, "A"));

            //
            //float point = 49f;

            Console.WriteLine("49.5f : grade : " + CalGrade(49.5f, ls));
            Console.WriteLine("0 : grade : " + CalGrade(0, ls));
            Console.WriteLine("72 : grade : " + CalGrade(72, ls));
            Console.WriteLine("70 : grade : " + CalGrade(70, ls));
            Console.WriteLine("43 : grade : " + CalGrade(43, ls));
            Console.WriteLine("28 : grade : " + CalGrade(28, ls));
            Console.WriteLine("97 : grade : " + CalGrade(97, ls));
            Console.WriteLine("23 : grade : " + CalGrade(23, ls));
            Console.WriteLine("84 : grade : " + CalGrade(84, ls));
            Console.WriteLine("64 : grade : " + CalGrade(64, ls));
            Console.WriteLine("72 : grade : " + CalGrade(74, ls));


            Console.ReadLine();

        }

        public static string CalGrade(float point, List list)
        {
            //int[] arr = { 800, 11, 50, 771, 649, 770, 240, 9 };

            int current = 0;
            int next = 0;

            for (int write = 0; write < list.Count - 1; write++)
            {
                current = write;
                next = current + 1;

                //55 <= 56 <= 60
                if (list[current].score <= point && point <= list[next].score)
                {
                    if (list[current].score >= point)
                    {
                        return list[current].grade;
                    }
                    else if (list[next].score <= point)
                    {
                        return list[next].grade;
                    }
                    else if (list[next].score >= point)
                    {
                        return list[current].grade;
                    }
                }
                else if (list[current].score > point)
                {
                    return list[current].grade;
                }
                else if (list[current].score <= point && point >= list[next].score)
                {
                    if (current == (list.Count - 2))
                    {
                        return list[current + 1].grade;
                    }
                }

            }
            return null;
        }

        public class Grades
        {
            public float score { set; get; }
            public string grade { set; get; }
            public Grades(float score, string grade)
            {
                this.score = score;
                this.grade = grade;
            }
        }
    }
}

Read More

Asp.net Mvc4 Could not load file or assembly 'WebGrease"

ไม่มีความคิดเห็น:
Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

answer worked http://stackoverflow.com/questions/19851912/could-not-load-file-or-assembly-webgrease-version-1-5-1-25624-culture-neutral

Read More

วันจันทร์ที่ 28 เมษายน พ.ศ. 2557

How to Fix HTTP Error 500.21 - Internal Server Error

ไม่มีความคิดเห็น:
มีขั้นตอนดังนี้
  1. เปิด command prompt ขึ้นมา
  2. จากนั้นก็นำคำสั่งด้านล่างนี้ไปวางแล้ว กด Enter
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

หรือ

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

ที่มาhttp://www.codeproject.com/Questions/412385/i-get-HTTP-Error-500-21-when-i-access-a-web-site-p
Read More

วันพฤหัสบดีที่ 24 เมษายน พ.ศ. 2557

วันพุธที่ 18 ธันวาคม พ.ศ. 2556

[asp.net] set required field validator with DropDownList

ไม่มีความคิดเห็น:

ss




code:

 <asp:DropDownList ID="DropDownList_newProduct" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList_newProduct_SelectedIndexChanged" Width="217px">
                <asp:ListItem Selected="True" Value="-1" Text="–กรุณาเลือก–"></asp:ListItem>
            </asp:DropDownList>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator_DropDownList_newProduct" runat="server" 
                CssClass="field-validation-error" ErrorMessage="Please enter!" ControlToValidate="DropDownList_newProduct" InitialValue="-1"/>
Read More