Click here to Skip to main content
11,796,275 members (77,197 online)
Rate this: bad
Please Sign up or sign in to vote.
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();

Posted 4-Jan-13 1:08am
Edited 4-Jan-13 1:36am
Zafar Sultan at 4-Jan-13 7:16am
Please complete your question. And do not write complete question as title.
Zafar Sultan at 4-Jan-13 7:24am
You are updating data in gridview's RowCommand event? How are you able to do that? Can you post your code?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

write your code for saving data in RowUpdating event of grid view.


after saving data make set one property of grid view
ie GridviewName.EditIndex = -1;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


please refer below link :[^]

hope it ll help you if not let me know please.

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

  Print Answers RSS
0 Maciej Los 460
1 Abhinav S 368
2 OriginalGriff 340
3 CPallini 269
4 Sergey Alexandrovich Kryukov 252
0 OriginalGriff 2,012
1 Maciej Los 1,615
2 KrunalRohit 1,310
3 CPallini 1,015
4 Richard MacCutchan 828

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100