Click here to Skip to main content
12,761,424 members (34,584 online)
Rate this:
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 2:08am
Updated 4-Jan-13 2:36am
Zafar Sultan 4-Jan-13 7:16am
Please complete your question. And do not write complete question as title.
Zafar Sultan 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2017
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