Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentDetails.aspx.cs" MasterPageFile="~/Site.master" Inherits="FirmusJobportal.StudentDetails" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<asp:Content ID="Content1" runat="server" contentplaceholderid="MainContent">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
        }
        .style3
        {
            width: 196px;
        }
        .style4
        {
            width: 113px;
        }
        .style5
        {
            width: 165px;
        }
        .style6
        {
            width: 166px;
            height: 49px;
        }
        .style7
        {
            width: 196px;
            height: 49px;
        }
        .style8
        {
            width: 113px;
            height: 49px;
        }
        .style9
        {
            width: 165px;
            height: 49px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <table class="style1">
        <tr>
            <td class="style2" colspan="9">
                <asp:Label ID="Label10" runat="server" Text="Candidate Details"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
            </td>
            <td class="style3">
                <asp:TextBox ID="txtCandidateName" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                <asp:Label ID="txtQualification" runat="server" Text="Qualification"></asp:Label>
            </td>
            <td class="style5">
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
                    onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                    <asp:ListItem>BE</asp:ListItem>
                    <asp:ListItem>BSc</asp:ListItem>
                    <asp:ListItem>B.Com</asp:ListItem>
                    <asp:ListItem>MBA</asp:ListItem>
                    <asp:ListItem>MCA</asp:ListItem>
                    <asp:ListItem></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style5">
                <asp:Label ID="Label3" runat="server" Text="YOP"></asp:Label>
            </td>
            <td class="style5">
                <asp:TextBox ID="txtYOP" runat="server" ></asp:TextBox>
            </td>
            <td class="style5">
                <asp:Label ID="Label4" runat="server" Text="Date"></asp:Label>
            </td>
            <td class="style5">
                <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
            </td>
            <td class="style5">
                <asp:Calendar ID="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged"
                    ></asp:Calendar>
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label5" runat="server" Text="Address 1"></asp:Label>
            </td>
            <td class="style3">
                <asp:TextBox ID="txtAddress1" runat="server" ></asp:TextBox>
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label6" runat="server" Text="Address 2"></asp:Label>
            </td>
            <td class="style3">
                <asp:TextBox ID="txtAddress2" runat="server" ></asp:TextBox>
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style6">
                <asp:Label ID="Label7" runat="server" Text="Streams"></asp:Label>
            </td>
            <td class="style7">
                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
                    >
                    <asp:ListItem>C</asp:ListItem>
                    <asp:ListItem>C++</asp:ListItem>
                    <asp:ListItem>Java</asp:ListItem>
                    <asp:ListItem>DotNet</asp:ListItem>
                    <asp:ListItem>Php</asp:ListItem>
                    <asp:ListItem>Networking</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style8">
            </td>
            <td class="style9">
            </td>
            <td class="style9">
            </td>
            <td class="style9">
            </td>
            <td class="style9">
            </td>
            <td class="style9">
            </td>
            <td class="style9">
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label8" runat="server" Text="Photo"></asp:Label>
            </td>
            <td class="style3">
                <asp:FileUpload ID="fleUploadResume" runat="server" style="height: 22px" />
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label9" runat="server" Text="Resume"></asp:Label>
            </td>
            <td class="style3">
                <asp:FileUpload ID="fleUploadImg" runat="server" />
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Button ID="Register" runat="server" Text="Register"
                    onclick="Registeration" />
            </td>
            <td class="style3">
                <asp:Button ID="Button2" runat="server" Text="Reset" onclick="Button2_Click" />
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
            <td class="style4">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
            <td class="style5">
                &nbsp;</td>
        </tr>
    </table>
    </form>
</body>
</html>
</asp:Content>




code behind .cs

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.IO;

namespace FirmusJobportal
{
    public partial class StudentDetails : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Registeration();
            }

        }
        protected void Registeration()
        {
            try
            {
                SqlConnection con = new SqlConnection("Data Source=ADMIN-PC;Initial Catalog=FirmusTraining; Integrated Security = True;");
                con.Open();
                // SqlCommand cmd1 = new SqlCommand("Select * from candidate_details", con);
                string name = txtCandidateName.Text;
                string Qualification = txtQualification.Text;
                string YOP = txtYOP.Text;
                string Date = txtDate.Text;
                string Address1 = txtAddress1.Text;
                string Address2 = txtAddress2.Text;
                string stream = string.Empty;
                for (int i = 0; i < DropDownList2.Items.Count; i++)
                {
                    if (DropDownList2.Items[i].Selected)
                    {
                        stream += DropDownList2.Items[i].Value + ";";
                    }
                }
                string filename1 = Path.GetFileName(fleUploadResume.PostedFile.FileName);
                fleUploadResume.SaveAs(Server.MapPath("Resume/" + filename1));

                string filename2 = Path.GetFileName(fleUploadImg.PostedFile.FileName);
                fleUploadResume.SaveAs(Server.MapPath("Images/" + filename2));

                //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ToString());
                // con.Open();

                SqlCommand cmd2 = new SqlCommand("insert into candidate_details(Name,Qualification,YOP, Date, Address1, Addrress2, stream, Resume_file,Imag_File) values('" + txtCandidateName.Text + "','" + txtQualification.Text + "','" + txtYOP.Text + "','" + txtDate.Text + "','" + txtAddress1.Text + "','" + txtCandidateName.Text + "','" + txtAddress2.Text + "','" + DropDownList2.Items + "','" + filename1 + "''" + filename2 + "')", con);
                cmd2.Parameters.AddWithValue("@Name", name);
                cmd2.Parameters.AddWithValue("@Qualification", Qualification);
                cmd2.Parameters.AddWithValue("@YOP", YOP);
                cmd2.Parameters.AddWithValue("@Date", Date);
                cmd2.Parameters.AddWithValue("@Address1", Address1);
                cmd2.Parameters.AddWithValue("@Address2", Address2);
                cmd2.Parameters.AddWithValue("@stream", stream);
                cmd2.Parameters.AddWithValue("@fleUploadResume", filename1);
                cmd2.Parameters.AddWithValue("@fleUploadImg", filename2);
                cmd2.ExecuteNonQuery();
                //The connection object initialization should be done here.
                con.Close();
                //  SqlDataAdapter da = new SqlDataAdapter(cmd);
                //DataSet ds = new DataSet();
                //da.Fill(ds);
                //if (ds.Tables[0].Rows.Count > 0)
                //  {
                //     gvDetails.DataSource = ds;
                //    gvDetails.DataBind();
                // }
                // else
                // {
                //     ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                //    gvDetails.DataSource = ds;
                //gvDetails.DataBind();
                //int columncount = gvDetails.Rows[0].Cells.Count;
                //gvDetails.Rows[0].Cells.Clear();
                //gvDetails.Rows[0].Cells.Add(new TableCell());
                //gvDetails.Rows[0].Cells[0].ColumnSpan = columncount;
                //gvDetails.Rows[0].Cells[0].Text = "No Records Found";
                // }
            }
            catch (Exception exp)
            {
            }
        }
        //protected void lnkDownload_Click(object sender, EventArgs e)
        //{
        //    LinkButton lnkbtn = sender as LinkButton;
        //    GridViewRow gvrow = lnkbtn.NamingContainer as GridViewRow;
        //    string filepath= gvDetails.DataKeys[gvrow.RowIndex].Value.ToString();
        //    Response.ContentType = "Resume/text";
        //    Response.AddHeader("Content-Disposition", "attachment;filepath=\"" + filepath + "\"");
        //    Response.TransmitFile(Server.MapPath(filepath));
        //    Response.End();
        //}
        // protected void SaveCandidateDetails(object sender, EventArgs e)// fileupload
        //    {
        //string s1 = "";
        // please see the method name "fileuploadresume", the method name is same as the control ID. It should not be like that.

        //string filename = Path.GetFileName(fleUploadResume.PostedFile.FileName);
        //string Name = Path.GetFileName(fleUploadResume.PostedFile.FileName);

        //string name = txtCandidateName.Text;
        //string Qualification = txtQualification.Text;
        //string SkillSet = txtSkill.Text;
        //string Resume_file = fleUploadResume;
        // for qualification and skillset, you have to take the values from the text boxes.

        //string Qualification = Path.GetFileName(fleUploadResume.PostedFile.Qualification);
        //string Skillset = Path.GetFileName(fleUploadResume.PostedFile.Skillset);
        //fleUploadResume.SaveAs(Server.MapPath("Resume/" + filename));
        //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ToString());
        // con.Open();
        // SqlCommand cmd = new SqlCommand("Insert into candidate_details(Name,Qualification,Skillset,FilePath) values(@Name,@Qualification,@Skillset,@FileName)", con);
        //SqlCommand cmd = new SqlCommand("insert into candidate_details(Name,Qualification,Skillset,Resume_file) values('" + txtCandidateName.Text + "','" + txtQualification.Text + "','" + txtSkill.Text + "','" + filename + "')", con);
        //cmd.Parameters.AddWithValue("@Name", name);
        //cmd.Parameters.AddWithValue("@Qualification", Qualification);
        //cmd.Parameters.AddWithValue("@Skillset", SkillSet);
        //cmd.Parameters.AddWithValue("@fleUploadResume", filename);
        ////cmd.Parameters.AddWithValue("@Filename", "resume/" + filename);
        //cmd.ExecuteNonQuery();
        ////The connection object initialization should be done here.
        //con.Close(); 
        // Done. I'm  disconnecting.
        // }



        protected void Button2_Click(object sender, EventArgs e)
        {
            string name = string.Empty;
            string Qualification = string.Empty;
            string YOP = string.Empty;
            string Date = string.Empty;
            string Address1 = string.Empty;
            string Address2 = string.Empty;
            string stream = string.Empty;
            string filename1 = string.Empty;
            string filename2 = string.Empty;

        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            txtDate.Text = Calendar1.SelectedDate.ToString();
        }

       
    }
}
Posted
Updated 26-Feb-13 21:40pm
v4
Comments
Orcun Iyigun 27-Feb-13 3:42am    
Well!! Isn't it your business to sort it out??? I don't even see a question? What the exception what are you trying to accomplish... You think we are some kind of psychics or something? Ask you your question clearly...
If you have any problem, then ask...
We are not going to research your code and find out the issues without knowing what to find.

So, please be specific while asking questions.
If you are facing any difficulty with this code, then just ask.
karthikeyan9966 27-Feb-13 4:03am    
i get error on aspx page.......
Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.

Source Error:


Line 1:
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 4:

Source File: /StudentDetails.aspx Line: 3

Quote:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.

From the error, it is clear that you are only allowed to place controls inside content page.
But you have also included the html, body, form tags, which are also there in Master Page.

So, when the page executes it finds these tags two times one in Master page and another in Content page, which is the problem.

Only define the controls inside the Content page, and make sure you don't repeat the tags in Content page.

Thanks...
 
Share this answer
 
remove <html>, <head>, <title>, <body>, <form> tag from your aspx code
 
Share this answer
 
v2
Comments
karthikeyan9966 27-Feb-13 11:42am    
thanks... but still i get this error in line 3
Line 1:
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 4:
karthikeyan9966 27-Feb-13 11:43am    
thanks... but still i get this error in line 3


Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.

Source Error:


Line 1:
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 4:

Source File: /StudentDetails.aspx Line: 3
vishal.shimpi 28-Feb-13 0:21am    
Remove....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900