I have a job list on gridview. when user click apply image button then apply panel is displayed...that collects user information with resume on fileupload then again he need to click apply button for apply to that job.....I am collect that information from apply panel ..but i cant have the resume from apply panel...How can i do that.....
Aspx page:
<asp:GridView ID="GridView1" GridLines="None" BorderStyle="None" runat="server" Width="100%" AutoGenerateColumns="False"
onpageindexchanging="GridView1_PageIndexChanging" AllowPaging="True" PageSize="20" OnRowCommand="GridView1_RowCommand" >
<columns>
<asp:TemplateField ControlStyle-BorderStyle="None">
<itemtemplate>
<%# Eval("Walkin_Title") %>--Exp.[<%#Eval("Exp")%>]
<%#Eval("Company_Name")%> Skills :<%#Eval("Skills")%>
<asp:Panel ID="ApplyPanel" runat="server" Visible="false" >
Job Location :<%# Eval("LocationName")%> | | <asp:ImageButton ID="ImageButton1" OnClick="ImageButton1_Click" CommandArgument='<%# Eval("WalkinID")%>' ImageUrl="~/images/apply.png" runat="server" /> | <asp:Label ID="maillbl" runat="server" Visible="false" Text='<%# Eval("ContactMail")%>' > | <asp:Label ID="resltlbl" runat="server" Text="Label" Visible="False" CssClass="Confirm_Msg"> |
| Apply for this job
<asp:Image ID="Image2" runat="server" Height="25px" ImageAlign="AbsMiddle"
ImageUrl="~/images/AboveArrow.jpg" Width="25px" />
| | <asp:ValidationSummary ID="ValidationSummary1" runat="server"
ValidationGroup="ApplyCheck" />
| valign="middle">
* | Your Name | <asp:TextBox ID="NameTxtbx" runat="server" Width="180px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="NameTxtbx" Display="None" ErrorMessage="Enter Name!"
SetFocusOnError="True" ValidationGroup="ApplyCheck">
| * | Your Email-ID | <asp:TextBox ID="EmailTxtbx" runat="server" Width="180px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="EmailTxtbx" Display="None" ErrorMessage="Enter Email-ID!"
SetFocusOnError="True" ValidationGroup="ApplyCheck">
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ErrorMessage="Enter Valid Mail ID!" ControlToValidate="EmailTxtbx"
Display="None" SetFocusOnError="True" ValidationGroup="ApplyCheck">
| | Your Mobile Number | <asp:TextBox ID="MobileTxtbx" runat="server" MaxLength="13" Width="180px">
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="MobileTxtbx" Display="None" ValidationExpression="^\d+$"
ErrorMessage="Enter Valid Mobile Number!" SetFocusOnError="True"
ValidationGroup="ApplyCheck">
| * | Attach your Resume | <asp:FileUpload ID="FileUpload1" runat="server" Width="180px" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ValidationExpression="^.*\.(doc|DOC|pdf|PDF|DOCX|docx|txt|TXT)$"
ErrorMessage="Upload Valid Document!" ControlToValidate="FileUpload1"
Display="None" SetFocusOnError="True" ValidationGroup="ApplyCheck">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="FileUpload1" Display="None"
ErrorMessage="Upload your Resume!" SetFocusOnError="True"
ValidationGroup="ApplyCheck">
| | Message
| | <asp:TextBox ID="MsgTxtbx" runat="server" Height="150px" TextMode="MultiLine"
Width="75%">
| | | <asp:Button ID="ApplyBtn" runat="server" Text="Apply" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Width="100px" CommandName="register" ValidationGroup="ApplyCheck" /> |
|
<pagersettings firstpagetext="" lastpagetext="">
Mode="NextPreviousFirstLast" NextPageText=""
PreviousPageText="Previous" FirstPageImageUrl="~/images/First_arrow.png"
LastPageImageUrl="~/images/Last_Arrow.png"
NextPageImageUrl="~/images/Next_arrow.png"
PreviousPageImageUrl="~/images/previous_arrow.png" />
<pagerstyle horizontalalign="Center" verticalalign="Bottom">
Aspx.cs :
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "register")
{
Random _r = new Random();
int index = Convert.ToInt32(e.CommandArgument.ToString());
TextBox New_NameTxtbx = (TextBox)GridView1.Rows[index].FindControl("NameTxtbx");
TextBox New_EmailTxtbx = (TextBox)GridView1.Rows[index].FindControl("EmailTxtbx");
TextBox New_MobileTxtbx = (TextBox)GridView1.Rows[index].FindControl("MobileTxtbx");
TextBox New_MsgTxtbx = (TextBox)GridView1.Rows[index].FindControl("MsgTxtbx");
Label New_resltlbl = (Label)GridView1.Rows[index].FindControl("resltlbl");
FileUpload Nw_FileUpload1 = (FileUpload)GridView1.Rows[index].FindControl("FileUpload1") as FileUpload;
string name = New_NameTxtbx.Text;
string email = New_EmailTxtbx.Text;
string mobile = New_MobileTxtbx.Text;
string msg = New_MsgTxtbx.Text;
string exe = Path.GetExtension(Nw_FileUpload1.PostedFile.FileName.ToString());
string resumeend = DateTime.Now.ToString().Replace(":", "").Replace(" ", "").Replace("/", "").Replace("AM", "").Replace("PM", "") + exe;
int n = _r.Next(5);
string resumename = n + name + resumeend;
Nw_FileUpload1.SaveAs(Server.MapPath("Resumes/" + resumename));
int val = Objwalkin.Add_AppliedJob(Convert.ToInt32(Session["JobId"]), name, email, msg, resumename, mobile);
if (val > 0)
{
New_resltlbl.Visible = true;
New_resltlbl.Text = "Applied Successfully!";
Panel NewApplyPanel = (Panel)GridView1.Rows[index].FindControl("ApplyPanel");
NewApplyPanel.Visible = false;
New_MobileTxtbx.Text = "";
New_EmailTxtbx.Text = "";
New_MsgTxtbx.Text = "";
New_NameTxtbx.Text = "";
}
else
{
New_resltlbl.Visible = true;
New_resltlbl.Text = "U R Already Applied for this Job!";
Panel NewApplyPanel = (Panel)GridView1.Rows[index].FindControl("ApplyPanel");
NewApplyPanel.Visible = false;
New_MobileTxtbx.Text = "";
New_EmailTxtbx.Text = "";
New_MsgTxtbx.Text = "";
New_NameTxtbx.Text = "";
}
}
}
protected void ImageButton1_Click(object sender, EventArgs e)
{
ImageButton ib = (ImageButton)sender;
Session["JobId"] = int.Parse(ib.CommandArgument);
GridViewRow Gvr = (GridViewRow)ib.NamingContainer;
Panel NewApplyPanel = (Panel)Gvr.FindControl("ApplyPanel");
if ( NewApplyPanel.Visible == true )
{
NewApplyPanel.Visible = false;
}
else
{
NewApplyPanel.Visible = true;
}
}