aerian -1 Newbie Poster

hye!

i m editing a grid view row which contains 2 columns.
lineid,filereference
lineid is read only but fileref is a template field i take it as hyperlink ,and hyperlink is editable.
i m taking command fields of edit,update,cancel.
but when i run ma program it is giving an error
error: unable to cast system.ui.web literalscontrol to System.UI.WEbcontrols and index out of range i m giving the correct index but i dont know why it is goiving this error
n this error generates where i m writing

textbox refno=(TexBox) dgcontainer.Rows[e.RowIndex].Cells[4].Controls[0]);

the code for the updating event is as below:

[
protected void dgcontainer_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox refno  = (TextBox)(dgcontainer.Rows[e.RowIndex].Cells[4].Controls[0]);
container.refnumber = refno.Text;
container.lineid=int.Parse(dgcontainer.Rows[e.RowIndex].Cells[0].Text);
container.updatecontainer();
this.Dispose();
dgcontainer.EditIndex=-1;
getdata();


}
]

plz help me to sort out this prob.