30 Jan 2014

Online examination system project In Asp Net with c#

Online examination system project In Asp Net with c#
Live-Online Examination System is an online examinationing program ran by qualified live examination online perfect for your children to enhance their education online. Online examinationing is an easy way to teach kids and to let them have fun while learning. Live-Online Examination System has advanced online examinationing techniques using an advanaced online classroom to examination children online. By using an online examinationing white board, both kids and examinations can write down their thoughts and communicate effectively over the internet. Your child's most valuable tool is his/her education and online examinationing is a great tool enhancer. By using Live-Online Examination System's online examination services you can create a fun online examination environment for your child.

Code : asp.net and c#  Datebase : SQL


Selecting topic for exam :

 protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null )
        {
            Response.Redirect("index.aspx");
           
        }
        txt_stdId.Text = Session["UserName"].ToString();
    }
    protected void DdlSubject_SelectedIndexChanged(object sender, EventArgs e)
    {
        Ddtopic.Items.Clear();
      
        string pr = DdlSubject.SelectedValue.ToString();
      // get topic names data set from class file
        ds = info.GetTopic(pr);
        Ddtopic.DataSource = ds;
        Ddtopic.DataBind();
        Ddtopic.Items.Insert(0, new ListItem("--Select--", "0"));
    }
    protected void Ddtopic_SelectedIndexChanged(object sender, EventArgs e)
    {
      
    }
    protected void DdlProgrm_SelectedIndexChanged(object sender, EventArgs e)
    {
        DdlSubject.Items.Clear();
        Ddtopic.Items.Clear();
     
        string pr = DdlProgrm.SelectedValue.ToString();
         // get subjects names data set from class file
        ds = info.GetSubjects(pr);
        DdlSubject.DataSource = ds;
        DdlSubject.DataBind();
        DdlSubject.Items.Insert(0, new ListItem("--Select--", "0"));
    }
    protected void ImgBtnStartExm_Click(object sender, ImageClickEventArgs e)
    {
    
        string prg = DdlProgrm.SelectedValue.ToString();
        string sub = DdlSubject.SelectedValue.ToString();
        string stp = Ddtopic.SelectedValue.ToString();
        string lvl = Ddllevel.SelectedValue.ToString();
        string rng = ddlrange.SelectedValue.ToString();
 // get questions and answers from table using  data set from class file
        DataSet ds = info.GetQuestions(sub, stp, lvl);
       
       
        int nquestions = ds.Tables[0].Rows.Count;
        int SIZE=Convert.ToInt32(rng);
        Random r = new Random();
        int[] positions = new int[SIZE];
        int num;
        for (int pos = 0; pos < SIZE; )
        {
            num = Math.Abs(r.Next(nquestions));
            // check whether the number is already in the array
            bool found = false;
            for (int i = 0; i < pos; i++)
                if (num == positions[i]) { found = true; break; }
            if (!found)
            {
                positions[pos] = num;
                pos++;
            }
        } // end of for                
         DataTable dt1 = new DataTable();
         dt1.Columns.Add("topic", typeof(string));
         dt1.Columns.Add("question", typeof(string));
         dt1.Columns.Add("option1", typeof(string));
         dt1.Columns.Add("option2", typeof(string));
         dt1.Columns.Add("option3", typeof(string));
         dt1.Columns.Add("option4", typeof(string));
         dt1.Columns.Add("cans", typeof(string));
         dt1.Columns.Add("level", typeof(string));
         dt1.Columns.Add("EXPLANATION", typeof(string));
         dt1.Columns.Add("(ANALYSIS/CORRECT)", typeof(string));
         dt1.Columns.Add("(ANALYSIS /WRONG)", typeof(string));
         foreach (int pos in positions)
         {
           
             dt1.ImportRow(ds.Tables[0].Rows[pos]);
         
         }
         DataSet ds3 = new DataSet();
         ds3.Tables.Add(dt1);
         Session["questionpaper"] = ds3;
         Session["starttime"] = DateTime.Now.ToString();
        Response.Redirect("~/login_startexam.aspx?program=" + prg + "&subject=" + sub + " &subtopic=" + stp + " &level=" + lvl + " &range=" + rng);
    }
Examination paper : 

 protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == "")
        {
            Response.Redirect("index.aspx");
        }
        DateTime dt = Convert.ToDateTime(Session["starttime"]);
        lblstarttime.Text = dt.ToString();
        lblcurrnttime.Text = DateTime.Now.ToString();
        if (!Page.IsPostBack)
        {
            GridView1.DataSource = (DataSet)Session["questionpaper"];
            GridView1.DataBind();
            lblSid.Text = Session["UserName"].ToString();
            lblsub.Text = Request.QueryString["subject"];
            lblprogrm.Text = Request.QueryString["program"];
            lbltopic.Text = Request.QueryString["subtopic"];
            lbllvl.Text = Request.QueryString["level"];
            lblrange.Text = Request.QueryString["range"];
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int d = GridView1.Rows.Count;
        string[] choice = new string[d];
        int increment = 0;
        foreach (GridViewRow r in GridView1.Rows)
        {
            string opt;
            RadioButton radio1;
            RadioButton radio2;
            RadioButton radio3;
            RadioButton radio4;
            radio1 = (RadioButton)r.FindControl("ra1");
            radio2 = (RadioButton)r.FindControl("ra2");
            radio3 = (RadioButton)r.FindControl("ra3");
            radio4 = (RadioButton)r.FindControl("ra4");
            DataSet ds2 = new DataSet();
            ds2 = (DataSet)Session["questionpaper"];
            if ((radio1.Checked == true || radio2.Checked == true || radio3.Checked == true || radio4.Checked == true))
            {
                if (radio1 != null && radio1.Checked)
                {
                    opt = "a";
                    string str1 = (ds2.Tables[0].Rows[increment]["cans"]).ToString();
                    if (opt == str1)
                    {
                        choice[index++] = str1;
                    }
                    else
                    {
                        choice[index++] = "a";
                    }
                }
                else if (radio2 != null && radio2.Checked)
                {
                    opt = "b";
                    string str1 = (ds2.Tables[0].Rows[increment]["cans"]).ToString();
                    if (opt == str1)
                    {
                        choice[index++] = str1;
                    }
                    else
                    {
                        choice[index++] = "b";
                    }
                }
                else if (radio3 != null && radio3.Checked)
                {
                    opt = "c";
                    string str1 = (ds2.Tables[0].Rows[increment]["cans"]).ToString();
                    if (opt == str1)
                    {
                        choice[index++] = str1;
                    }
                    else
                    {
                        choice[index++] = "c";
                    }
                }
                else if (radio4 != null && radio4.Checked)
                {
                    opt = "d";
                    string str1 = (ds2.Tables[0].Rows[increment]["cans"]).ToString();
                    if (opt == str1)
                    {
                        choice[index++] = str1;
                    }
                    else
                    {
                        choice[index++] = "d";
                    }
                }


            }
            else
            {
                choice[index++] = "empty";
            }
            increment++;
        
            }
        if (GridView1.Rows.Count == increment)
        {
          
            string prg = lblprogrm.Text;
            string sub = lblsub.Text;
            string stp = lbltopic.Text;
            string lvl = lbllvl.Text;
            string rng = lblrange.Text;
            List<string> quest = new List<string>();
            List<string> opt1 = new List<string>();
            List<string> opt2 = new List<string>();
            List<string> opt3 = new List<string>();
            List<string> opt4 = new List<string>();
            List<string> CAns = new List<string>();
            List<string> myans = new List<string>();
            DataSet ds2 = (DataSet)Session["questionpaper"];
            foreach (DataRow row in ds2.Tables[0].Rows)
            {
                quest.Add(row["question"].ToString());
                opt1.Add(row["option1"].ToString());
                opt2.Add(row["option2"].ToString());
                opt3.Add(row["option3"].ToString());
                opt4.Add(row["option4"].ToString());
                CAns.Add(row["cans"].ToString());
            }



            string[] Questions = quest.ToArray();
            string[] Option1 = opt1.ToArray();
            string[] Option2 = opt2.ToArray();
            string[] Option3 = opt3.ToArray();
            string[] Option4 = opt4.ToArray();
            string[] correctAns = CAns.ToArray();

            int ind;
            for (ind = 0; ind <= d - 1; ind++)
            {
                myans.Add(choice[ind]);
            }
            string[] mychoice = new string[d];
            mychoice = myans.ToArray();
            int count = 0;
            for (int i = 0; i < correctAns.Length; i++)
            {
                for (int j = i; j < mychoice.Length; j++)
                {
                    if (correctAns[i] == mychoice[j])
                    {
                        count++;
                    }
                    i++;
                }         
            }
            int scr= 0 ;
           
            Session["scr"] = count++;
            TimeSpan duration = Convert.ToDateTime(Session["starttime"]) - DateTime.Now;
            string totltime = duration.ToString();
          //info.insertexamdetails(lblSid.Text, lblprogrm.Text, lblsub.Text, lbltopic.Text, lbllvl.Text, lblrange.Text, string.Join(",", Questions), string.Join(",", Option1), string.Join(",", Option2), string.Join(",", Option3), string.Join(",", Option4), string.Join(",", correctAns), string.Join(",", mychoice), scr);
       info.insertexamdetails(lblSid.Text, lblprogrm.Text, lblsub.Text, lbltopic.Text, lbllvl.Text, lblrange.Text, string.Join("@", Questions), string.Join("@", Option1), string.Join("@", Option2), string.Join("@", Option3), string.Join("@", Option4), string.Join("@", Array.ConvertAll(correctAns, x => x.ToString())), string.Join("@", Array.ConvertAll(mychoice, x => x.ToString())), Convert.ToInt32(Session["scr"]));
       Response.Redirect("Result.aspx?program=" + prg + "&subject=" + sub + " &subtopic=" + stp + " &level=" + lvl + " &range=" + rng + " &tottym=" + totltime);
        }
    }
view my result :

  protected void Page_Load(object sender, EventArgs e)
    {
        lblprogrme.Text = Request.QueryString["program"];
        lblsub.Text = Request.QueryString["subject"];
        lbltopic.Text = Request.QueryString["subtopic"];
        lbllevel.Text = Request.QueryString["level"];
        lblNquestions.Text = Request.QueryString["range"];   
        lblStime.Text = Session["starttime"].ToString();
        lblMin.Text = Request.QueryString["tottym"];
        int cnt = Convert.ToInt32(Session["scr"]);
        lblscore.Text = cnt.ToString();
        if (cnt > 19)
            lblGrade.Text = "Excellent";
        else
            if (cnt > 9)
                lblGrade.Text = "Average";
            else
                lblGrade.Text = "Poor";
     
    }
View my answer sheet :

 

protected void Page_Load(object sender, EventArgs e)
    {
       
            bindgrid();
       
     
    }
    private void bindgrid()
    {
        DataSet ds = info.Getmyexampaper(Session["UserName"].ToString());
        string quest = (ds.Tables[0].Rows[0]["examquestions"]).ToString();
        string op1 = (ds.Tables[0].Rows[0]["examanswers1"]).ToString();
        string op2 = (ds.Tables[0].Rows[0]["examanswers2"]).ToString();
        string op3 = (ds.Tables[0].Rows[0]["examanswers3"]).ToString();
        string op4 = (ds.Tables[0].Rows[0]["examanswers4"]).ToString();
        string corans = (ds.Tables[0].Rows[0]["correctanswer"]).ToString();
        string myan = (ds.Tables[0].Rows[0]["myanswer"]).ToString();
        DataTable dt = new DataTable();
        dt.Columns.Add("QUE");
        dt.Columns.Add("OPT1");
        dt.Columns.Add("OPT2");
        dt.Columns.Add("OPT3");
        dt.Columns.Add("OPT4");
        dt.Columns.Add("ANS");
        dt.Columns.Add("MYANS");
        int cnt = Convert.ToInt32(ds.Tables[0].Rows[0]["rang"]);
        for (int i = 0; i < cnt; i++)
        {
            string[] Aquest = quest.Split('@');
            string[] Aop1 = op1.Split('@');
            string[] Aop2 = op2.Split('@');
            string[] Aop3 = op3.Split('@');
            string[] Aop4 = op4.Split('@');
            string[] Acorans = corans.Split('@');
            string[] Amyan = myan.Split('@');
            DataRow dr = dt.NewRow();
            dr["QUE"] = Aquest[i];
            dr["OPT1"] = Aop1[i];
            dr["OPT2"] = Aop2[i];
            dr["OPT3"] = Aop3[i];
            dr["OPT4"] = Aop4[i];
            dr["ANS"] = Acorans[i];
            dr["MYANS"] = Amyan[i];
            dt.Rows.Add(dr);
        }
        gvdetails.DataSource = dt;
        gvdetails.DataBind();
    
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }
   
    protected void btnExcel_Click(object sender, ImageClickEventArgs e)
    {
        Response.ClearContent();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Customers.xls"));
        Response.ContentType = "application/ms-excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gvdetails.AllowPaging = false;
        gvdetails.DataBind();
        //Change the Header Row back to white color
        gvdetails.HeaderRow.Style.Add("background-color", "#FFFFFF");
        //Applying stlye to gridview header cells
        for (int i = 0; i < gvdetails.HeaderRow.Cells.Count; i++)
        {
            gvdetails.HeaderRow.Cells[i].Style.Add("background-color", "#507CD1");
        }
        int j = 1;
        //This loop is used to apply stlye to cells based on particular row
        foreach (GridViewRow gvrow in gvdetails.Rows)
        {
            gvrow.BackColor = System.Drawing.Color.White;
            if (j <= gvdetails.Rows.Count)
            {
                if (j % 2 != 0)
                {
                    for (int k = 0; k < gvrow.Cells.Count; k++)
                    {
                        gvrow.Cells[k].Style.Add("background-color", "#EFF3FB");
                    }
                }
            }
            j++;
        }
        gvdetails.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }
    protected void btnWord_Click(object sender, ImageClickEventArgs e)
    {
        gvdetails.AllowPaging = false;
        gvdetails.DataBind();
        Response.ClearContent();
        Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Customers.doc"));
        Response.Charset = "";
        Response.ContentType = "application/ms-word";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gvdetails.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }
    protected void gvdetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvdetails.PageIndex = e.NewPageIndex;
        bindgrid();
    }


87 comments:

  1. hi I want source code as zip folder please

    ReplyDelete
  2. hi can I download compete source code as a zip folder .........Thank u very very much

    ReplyDelete
  3. Hi. I want source code. Plz help me..

    ReplyDelete
  4. can you give link to download source code???

    ReplyDelete
  5. plz send the source code in my mail id: anandcrks@gmail.com

    ReplyDelete
  6. Please Send me Source Code on sabaaqeel.aqeelahmad@gmail.com

    ReplyDelete
  7. plz send the source code in my mail id:patelsavan1113@gmail.com

    ReplyDelete
  8. Please immediately Send me Source Code on manojranjan0@gmail.com or ranjanmanoj@ymail.com..

    thankfully..

    ReplyDelete
  9. please send me source code in zip file!! at fakhar.csv@gmail.com

    ReplyDelete
  10. hey,
    please send me source code in zip file at prafulla.nepal@gmail.com

    ReplyDelete
  11. hey
    please send me source code in zip file!! at prafulla.nepal@gmail.com

    ReplyDelete
  12. Please very much, send me source code and data base in rar/zip file!
    E-mail: flavius.manuel96@gmail.com

    ReplyDelete
  13. hi I want source code as zip folder

    ReplyDelete
  14. hi ,i want source code ,i like your source code can you send me.This is my email.

    tinwinaung20@gmail.com.Thank you so much.

    ReplyDelete
  15. hi plz send me source code at dh91maurya@gmail.com

    ReplyDelete
  16. Could you please send link for download code through anssary@gmail.com

    ReplyDelete
  17. hi plz send me source code at kriptacool90@gmail.com

    ReplyDelete
  18. hi plz send me source code at aartidevi200@gmail.com
    plz its urgent.

    ReplyDelete
  19. hi plz send me source code at aartidevi200@gmail.com
    plz its urgent.

    ReplyDelete
  20. hi plz send me source code at aartidevi200@gmail.com
    plz its urgent.

    ReplyDelete
  21. hi plz send me source code at aartidevi200@gmail.com
    plz its urgent.

    ReplyDelete
  22. hi plz send me source code at aartidevi200@gmail.com
    plz its urgent.

    ReplyDelete
  23. khushich64@yahoo.com is my id please send me the code

    ReplyDelete
  24. PLease send the whole source code to vidushibaru@gmail.com

    ReplyDelete
  25. Please send me the source code at arvindid@gmail.com

    ReplyDelete
  26. can i share this article code in my blog www.dotnetspan.com

    ReplyDelete
  27. It's very nice.... can u Please send me the source code and its description at "signup.bucks@gmail.com" .... i want implement it in real time environment and its urgent....

    ReplyDelete
  28. Hi can you send me source code siddaram1974@gmail.com

    ReplyDelete
  29. Please send me the source code at rajatgoel1993@gmail.com

    ReplyDelete
  30. hi its very nice can u please send the source code and its description at aneelkurakula@gmail.com

    ReplyDelete
  31. Please send the whole source code to sudha.sananth@gmail.com

    ReplyDelete
  32. Please send the whole source code to sudha.sananth@gmail.com

    ReplyDelete
  33. Please send the whole source code to sudha. alexis@unitec.edu and bd

    ReplyDelete
  34. Please send me the source code and steps to execute the program as zippedfile

    ReplyDelete

  35. Please send the whole source code to tsaganaa@gmail.com

    ReplyDelete
  36. It's very nice.... can u Please send me the source code and its description at "tsaganaa@gmail.com" .... i want implement it in real time environment and its urgent....

    ReplyDelete
  37. It's very nice.... can u Please send me the source code and its description at "tsaganaa@gmail.com" .... i want implement it in real time environment and its urgent....

    ReplyDelete
  38. Any version in ASP.NET MVC ? source code in github ?


    Any final _solution_ with **full source code** sample application ? _IMHO, better samples for minimize learning curve are real applications with full source code and good patterns_

    ReplyDelete
  39. Please send me the source code and steps to execute the program as zip
    amirnowrozian@gmail.com

    ReplyDelete
  40. Plz Send me the souce code step by step mobaidalikhan@gmail.com

    ReplyDelete
  41. please send me source code pathanyunus1@gmail.com

    ReplyDelete
  42. Please send me the source code and steps to execute the program as zippedfile to vmurtezaj@gmail.com

    ReplyDelete
  43. Please send me the source code Zip file and steps at amol20989@gmail.com

    ReplyDelete
  44. Please send me the source code Zip File and steps at amol20989@gmail.com

    ReplyDelete
  45. please send me code memon_rahib@yahoo.com

    ReplyDelete
  46. send me this code please memon_rahib@yahoo.com

    ReplyDelete
  47. hi i m keran, i will mail you soon . . thankyou

    ReplyDelete
    Replies
    1. Sir plz send me source code viveksengar80@gmail.com

      Delete
    2. Please send the sourcoe code for this project
      sahilbharti.brt135@gmail.com

      Delete
  48. send me this code please pranitagupta57@gmail.com

    ReplyDelete
  49. Please send the whole source code to hardik6992@gmail.com

    ReplyDelete
  50. It is great job karen. Could u send me z source code to ethiogt.gt@gmail.com plz.

    ReplyDelete
  51. It is great job Karen.Could u send me the source code to ethiogt.gt@gmail.com plz.

    ReplyDelete
  52. send me this code please on my mail id kanchan.pande1990@gmail.com

    ReplyDelete
  53. great effort, please, can I download the complete project?

    ReplyDelete
  54. great effort, pleas, can I download the complete project?

    ReplyDelete
  55. Hi Karen can You send me a source code please

    ReplyDelete
  56. Hi Karen can You send me a source code please

    ReplyDelete
  57. please send me code at mohit55566@gmail.com

    ReplyDelete
  58. Hi please send me source code on anilahmed08@gmail.com thank you

    ReplyDelete
  59. PLease send the whole source code to bilalhsa100@gmail.com

    ReplyDelete
  60. sir please mail me this project code ..........my email is bilalhsa100@gmail.com

    ReplyDelete
  61. Hey Keran, can you send me source code at : mrmalkar@yahoo.com

    ReplyDelete
  62. hi, plz send me at raisuddin@rkmsolution.com

    ReplyDelete
  63. hi my friend
    Please send me the source code Zip File and steps at empire4672@gmail.com
    thanks

    ReplyDelete
    Replies
    1. hi
      Please send me the source code Zip File and steps at mariafleur.96@gmail.com
      thanks

      Delete
  64. I have need this please send me on Email inam.aa88@gmail.com

    ReplyDelete
  65. I Have Need Zip File f this code Please Send Me Dear Karen kumar

    ReplyDelete
  66. Please help with the Source Code for better understanding of you assistance thank larshittu@gmail.com

    ReplyDelete
  67. Please send me the source code Zip File at adriana.lleshi94@gmail.com
    thanks

    ReplyDelete
  68. Hello sir,

    I want this code,can you please sent this source code on my mail id : sumathyarulraj@gmail.com.

    ReplyDelete
  69. Hello sir,
    i want this source code file, please sent on this mail id : sumathyarulraj@gmail.com

    ReplyDelete
  70. hello sir, I want this complete project source code file and document. Its very uregent kindly send on this mail id :sumathyarulraj@gmail.com

    ReplyDelete
  71. please sir i requested to source code and data base to send in my email address...my email address is prajapatiabhaji@gmail.com

    ReplyDelete
  72. please sir i requested to source code and data base to send in my email address...my email address is prajapatiabhaji@gmail.com

    ReplyDelete
  73. sir please mail me this project code .my email is serhat.gunes.92@gmail.com

    ReplyDelete
  74. Hi your article more helpfull us please send me your source code and db

    ReplyDelete
  75. pleas could you send the source code to me it will help to learn how to manage small project

    mmao-@hotmail.com

    thanks

    ReplyDelete
  76. hi can you send me the horse code it will help me pleas

    ReplyDelete
  77. hi can you sed me a copy from the horse cod it really help me
    mmao-@hotmail.com

    ReplyDelete
  78. please send me the source code at nireng553@gmail.com it will help me a lot to understand and for further studies

    ReplyDelete
  79. hello sir can you send me the full project in zib file please at azzam_maher@hotmail.com

    ReplyDelete
  80. Your metyhod of telling everything in this paragraph is genuinely good, every one be abpe to without difficulty know it, Thanks a lot.

    ReplyDelete
  81. hi can you please email this project at buzz10719@gmail.com

    ReplyDelete
  82. What a ddata oof un-ambiguity and preserveness of precious know-how on tthe topic of unexpected emotions.

    ReplyDelete