ERIKA
دوشنبه 25 مهر 1390, 18:18 عصر
با سلام
من کد زیر را برای حذف مینویسم عملیات حذف انجام میشه ولی به جای نمایش دیتا گرید ویو صفحه با خطای زیر روبه رو میشوم
protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string ID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text;
cn.Command("delete from tbStudent where StudentID=" + ID);
GridView1.DataSource = null;
cn.bindGrid("select * from tbStudent order by StudentID", GridView1);
lblMessage.Text = "عمليات حذف با موفقيت انجام شد!";
}
if (e.CommandName == "Edit")
{
Session.Contents.Add("StudentID", GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text);
int ID = Convert.ToInt32(Session.Contents["StudentID"]);
txtStudentNumber.Text = Convert.ToString(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].Text);
txtName.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text);
txtFamily.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[3].Text);
txtNational.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[4].Text);
txtNational.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[5].Text);
txtStudentNumber.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[6].Text);
txtAdress.Text= (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[7].Text);
txtEmail.Text= (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[8].Text);
txtTarikhTavaold.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[9].Text);
txtSex.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[10].Text);
btnEdit.Visible = true;
من بریک پوینت هم گذاشتم عملیات به درستی باید انجام بشه و بعد باید صفحه لود شه که با این خطا مواجه میشوم
btnSave.Visible = false;
lblMessage.Text = "خبر انتخاب شده آماده تغييرات است. براي ثبت تغييرات، تغييرات دلخواه را اعمال و بر روي دكمه 'ذخيره تغييرات' كليك نماييد.";
}
}
[/CODE]
در مورد اپدیت هم اطلاعات را لود به داخل تکس باکس ها نمیکنه و خطای زیر را دارم.
The GridView 'GridView1' fired event RowDeleting which wasn't handled.
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.Web.HttpException: The GridView 'GridView1' fired event RowDeleting which wasn't handled.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The GridView 'GridView1' fired event RowDeleting which wasn't handled.] System.Web.UI.WebControls.GridView.OnRowDeleting(G ridViewDeleteEventArgs e) +1463321 System.Web.UI.WebControls.GridView.HandleDelete(Gr idViewRow row, Int32 rowIndex) +637 System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +952 System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String eventArgument) +210 System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +176 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
من کد زیر را برای حذف مینویسم عملیات حذف انجام میشه ولی به جای نمایش دیتا گرید ویو صفحه با خطای زیر روبه رو میشوم
protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string ID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text;
cn.Command("delete from tbStudent where StudentID=" + ID);
GridView1.DataSource = null;
cn.bindGrid("select * from tbStudent order by StudentID", GridView1);
lblMessage.Text = "عمليات حذف با موفقيت انجام شد!";
}
if (e.CommandName == "Edit")
{
Session.Contents.Add("StudentID", GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text);
int ID = Convert.ToInt32(Session.Contents["StudentID"]);
txtStudentNumber.Text = Convert.ToString(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].Text);
txtName.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text);
txtFamily.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[3].Text);
txtNational.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[4].Text);
txtNational.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[5].Text);
txtStudentNumber.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[6].Text);
txtAdress.Text= (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[7].Text);
txtEmail.Text= (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[8].Text);
txtTarikhTavaold.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[9].Text);
txtSex.Text = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[10].Text);
btnEdit.Visible = true;
من بریک پوینت هم گذاشتم عملیات به درستی باید انجام بشه و بعد باید صفحه لود شه که با این خطا مواجه میشوم
btnSave.Visible = false;
lblMessage.Text = "خبر انتخاب شده آماده تغييرات است. براي ثبت تغييرات، تغييرات دلخواه را اعمال و بر روي دكمه 'ذخيره تغييرات' كليك نماييد.";
}
}
[/CODE]
در مورد اپدیت هم اطلاعات را لود به داخل تکس باکس ها نمیکنه و خطای زیر را دارم.
The GridView 'GridView1' fired event RowDeleting which wasn't handled.
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.Web.HttpException: The GridView 'GridView1' fired event RowDeleting which wasn't handled.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The GridView 'GridView1' fired event RowDeleting which wasn't handled.] System.Web.UI.WebControls.GridView.OnRowDeleting(G ridViewDeleteEventArgs e) +1463321 System.Web.UI.WebControls.GridView.HandleDelete(Gr idViewRow row, Int32 rowIndex) +637 System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +952 System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String eventArgument) +210 System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +176 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1