G
Guest
Hi, I have been on this for hours and just cannot work it out.
I have a datagrid. I set the edititem index to a row to edit, that works.
However if i want to put a value into this textbox it wont let me. I just
cant find the control in the controlcollection for the cell. Is it because it
hasnt rendered yet? (very annoying as i have set the edititem to the index,
done my databound etc.) why doesnt it recognise the textbox? so:
dgThing.EditItemIndex = e.Item.ItemIndex;
get my source and do DataBind();
TextBox aBox = (TextBox)e.Item.Cells[2].Controls[0]; //i found this code in
msdn so i know its right
thisText.Text="set this text into the textbox";
Because i have to just work out the cells (there is not cell id) i have just
counted. I am def on the right one. The one before it has some text in it,
so i know where i am in the row. but it cant find the textbox control having
just gone into edit mode. Has anyone got round this somehow? Another thing,
why do I have to databind again. I only want to change one row yet i have to
go to my sql database and run a complicated query EVERY time to populate data
which was already there, just to get my item to go into edit mode! is this
the only way?
I have a datagrid. I set the edititem index to a row to edit, that works.
However if i want to put a value into this textbox it wont let me. I just
cant find the control in the controlcollection for the cell. Is it because it
hasnt rendered yet? (very annoying as i have set the edititem to the index,
done my databound etc.) why doesnt it recognise the textbox? so:
dgThing.EditItemIndex = e.Item.ItemIndex;
get my source and do DataBind();
TextBox aBox = (TextBox)e.Item.Cells[2].Controls[0]; //i found this code in
msdn so i know its right
thisText.Text="set this text into the textbox";
Because i have to just work out the cells (there is not cell id) i have just
counted. I am def on the right one. The one before it has some text in it,
so i know where i am in the row. but it cant find the textbox control having
just gone into edit mode. Has anyone got round this somehow? Another thing,
why do I have to databind again. I only want to change one row yet i have to
go to my sql database and run a complicated query EVERY time to populate data
which was already there, just to get my item to go into edit mode! is this
the only way?