Click here to Skip to main content
Rate this: bad
good
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();
}
else
{
 
}
}
}
Posted 4-Jan-13 2:08am
Edited 4-Jan-13 2:36am
v3
Comments
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
good
Please Sign up or sign in to vote.

Solution 1

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  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
0 Sergey Alexandrovich Kryukov 8,963
1 OriginalGriff 6,726
2 Peter Leow 4,232
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,558


Advertise | Privacy | Mobile
Web01 | 2.8.150123.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