Dear Sir,
I want to pass value from next page and display all values in next page but . while i have do this . i have getting error..
Server Error in '/' 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 16: protected void Page_Load(object sender, EventArgs e)
Line 17: {
Line 18: empno = Convert.ToInt32(Request.QueryString["Sr_no"].ToString());
Line 19: if (!IsPostBack)
Line 20: {
|
Source File: c:\Users\Administrator\Documents\Visual Studio 2012\Projects\Cntrct_clsr\Cntrct_clsr\UpdateGridView.aspx.cs Line: 18 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
Cntrct_clsr.UpdateGridView.Page_Load(Object sender, EventArgs e) in c:\Users\Administrator\Documents\Visual Studio 2012\Projects\Cntrct_clsr\Cntrct_clsr\UpdateGridView.aspx.cs:18
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.4330.0
namespace Cntrct_clsr
{
public partial class WebForm1 : System.Web.UI.Page
{
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("~/UpdateGridView.aspx?Sr_no=" + row.Cells[0].Text);
}
}
}
}
UpdateGridView.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace Cntrct_clsr
{
public partial class UpdateGridView : System.Web.UI.Page
{
int empno = 0;
protected void Page_Load(object sender, EventArgs e)
{
empno = Convert.ToInt32(Request.QueryString["Sr_no"].ToString());
if (!IsPostBack)
{
BindTextBoxvalues();
}
}
}
}