How to update textbox into label

Posted by Oswaldlily under ASP.NET on 2/7/2013 | Points: 10 | Views : 1073 | Status : [Member] | Replies : 3
Edit-Update/Cancel inside gridview.

while editing,I has like
{
TextBox txt1 = (TextBox)gv.Rows[e.RowIndex].Cells[10].FindControl("txt1");
_remarks = txt1.Text;
}


while updating,this shd come in label..
In gv_Update I has like
{
Label lbl1 = (TextBox)gv.Rows[e.RowIndex].Cells[10].FindControl("lbl1");
_remarks = lbl1.Text;
}

I m facing error in label part.
how textbox in edit part will copy to laby part of update




Responses

Posted by: Oswaldlily on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
sorry

I used bind method in design page ..came

Text='<%#Bind("IT_txt") %>'

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kusumas on: 2/8/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Your finding the lable value but your using textbox when the finding the value.

Label lbl1 = (TextBox )gv.Rows[e.RowIndex].Cells[10].FindControl("lbl1");


Label lbl1 = (Label )gv.Rows[e.RowIndex].Cells[10].FindControl("lbl1");

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/20/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
try this code

label only assign label same textbox also.we assign this

TextBox Txt1 = (TextBox)grid1.Rows[e.RowIndex].Cells[1].FindControl("txtName");
Label lbl1 = new Label();
lbl1.Text = Txt1.Text;

Mark as Answer if its helpful to you

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response