Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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
Updated 4-Jan-13 1:36am
v3
Comments
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?

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;
 
Share this answer
 
v3
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900