Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NET

i have 1 gridview while i click on gridview edit button using rowcommand event it fetchs all the detail using ID by command argument in code behind. but while i am save that data and bind the gridview at that time my grid view column converted into textbox so how can i resolve.
 
please help me to find out its solution. please.
my code is
 
if (e.CommandName.ToString() == "Edit")
{
FeesRefund_BL objFeesRefund_BL = new FeesRefund_BL();
 
if (rblFees.SelectedValue == "Deposit")
{
ViewState["StudentID"] = Convert.ToInt32(e.CommandArgument.ToString());
//pnlDetail.Visible = true;
btnApprove.Visible = false;
btnCancel.Visible = false;
btnoApprove.Visible = false;
btnoCancel.Visible = false;
pnlDeposit.Visible = true;
pnlOther.Visible = false;
 
ApplicationResult objDepositDetail = new ApplicationResult();
DataTable dtDepositDetail = new DataTable();
objDepositDetail = objFeesRefund_BL.FeesRefund_Select_DepositDetail_By_StudentId(Convert.ToInt32(ViewState["StudentID"]));
 
if (objDepositDetail != null)
{
dtDepositDetail = objDepositDetail.resultDT;
 
if (dtDepositDetail.Rows.Count > 0)
{
ViewState["FeesRefundID"] = dtDepositDetail.Rows[0]["FeesRefund_ID"].ToString();
txtUniqueID.Text = dtDepositDetail.Rows[0]["UniqueID"].ToString();
txtName.Text = dtDepositDetail.Rows[0]["Name"].ToString();
txtSemester.Text = dtDepositDetail.Rows[0]["Semester"].ToString();
 
txtDeposit.Text = dtDepositDetail.Rows[0]["TotalRefundAMT"].ToString();
txtDeduction.Text = dtDepositDetail.Rows[0]["Deduction"].ToString();
txtTotal.Text = dtDepositDetail.Rows[0]["FinalRefundAMT"].ToString();
 
txtReason.Text = dtDepositDetail.Rows[0]["Reason"].ToString();
}
else
{
 
}
}
}
Posted 4 Jan '13 - 1:08
Edited 4 Jan '13 - 1:36

Comments
Zafar Sultan - 4 Jan '13 - 7:16
Please complete your question. And do not write complete question as title.
Zafar Sultan - 4 Jan '13 - 7:24
You are updating data in gridview's RowCommand event? How are you able to do that? Can you post your code?

2 solutions

write your code for saving data in RowUpdating event of grid view.
 
or
 
after saving data make set one property of grid view
ie GridviewName.EditIndex = -1;
  Permalink  
Hi,
 
please refer below link :
 
http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html[^]
 
hope it ll help you if not let me know please.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 208
1 OriginalGriff 203
2 Abhinav S 168
3 Rohan Leuva 150
4 Abhishek Pant 145
0 Sergey Alexandrovich Kryukov 8,474
1 OriginalGriff 6,714
2 CPallini 3,603
3 Rohan Leuva 2,853
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid