Server Error in '/Sfty_inf_sys' Application.
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error:
Line 17: {
Line 18:
Line 19: empno = Convert.ToInt32(Request.QueryString["Id"].ToString());
Line 20: Session["EmpId"] = empno;
Line 21: String EmplooyeId = Session["emp_id"].ToString();
|
Source File: c:\inetpub\wwwroot\sfty1\sfty1\image.aspx.cs Line: 19 Stack Trace:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12838615
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +122
System.Convert.ToInt32(String value) +48
sfty1.image.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\sfty1\sfty1\image.aspx.cs:19
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
System.Web.UI.Control.OnLoad(EventArgs e) +97
System.Web.UI.Control.LoadRecursive() +61
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0
<%@ Page Language="C#" AutoEventWireup="true" Codefile="sdor.aspx.cs" Inherits="sfty1.sdor" %>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<link href="jquery-ui-1.12.1.custom/jquery-ui.min.css" rel="stylesheet" />
<script src="Scripts/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.MultiFile.js" type="text/javascript"></script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body bgcolor="#CEC0BD" class="auto-style11">
<form id="form1" runat="server" enctype="multipart/form-data">
<asp:GridView ID="GridView1"
HeaderStyle-BackColor="#99ccff"
HeaderStyle-ForeColor="black"
DataKeyNames="Id"
runat="server" Font-Size="Medium" AutoGenerateColumns="False"
HeaderStyle-Font-Size="17px"
OnRowCommand="GridView1_RowCommand"
EmptyDataText="Your Last Month Data has been Submited in Database!"
Height="146px" Width="1240px"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowCancelingEdit ="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating"
CssClass="auto-style56" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
<Columns>
<asp:TemplateField HeaderText="Id">
<ItemTemplate>
<asp:Label ID="Id" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<asp:Label ID="lbldt" runat="server" Text='<%# Eval("dt") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_dt" runat="server" Height="30px" Width="70px" ItemStyle-Width="80" Text='<%#Eval("dt") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:Button ID="btn_Edit" runat="server" Text="Edit" CausesValidation="false" CommandName="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button ID="btn_Update" runat="server" Text="Update" CausesValidation="false" CommandName="Update"/>
<asp:Button ID="btn_Cancel" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel"/>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<asp:Button ID="LinkButton1" Text="Image" runat="server" CausesValidation="false" OnClick="ImgButton1_Click" CommandName="EditButton" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView></td>
</form>
</body>
</html>
namespace sfty1
{
public partial class sdor : System.Web.UI.Page
{
string cs = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con;
SqlDataAdapter adapt;
DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
if (Session["emp_nm"] == null)
Response.Redirect("Sssn.aspx");
else
{
String EmplooyeId = Session["emp_id"].ToString();
lblName.Text = " " + EmplooyeId + "";
String emp_nm = Session["emp_nm"].ToString();
Label1.Text = "" + emp_nm + " ";
String dept = Session["dept"].ToString();
Label2.Text = "" + dept + " ";
Label1.Text = Label1.Text.ToUpper();
Label2.Text = Label2.Text.ToUpper();
}
Label3.Text = String.Format("{0}", DateTime.Now.ToString("MM/yyyy"));
}
private void BindGrid()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
//SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM bpms WHERE EMP_ID=" + Session["emp_id"] + " and mrk_in_fa='NO'", con);
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM sdor WHERE emp_id=" + Session["emp_id"] + "and cls_flg='N'", con);
DataTable dt = new DataTable();
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditButton")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Redirect("image.aspx?Id=" + row.Cells[0].Text + "&EmplooyeId=" + Label1.Text + "&emp_nm=" + Label2.Text + "&dept=" + Label3.Text);
}
}
}
}