Dynamically created Datgrid will not enter Edit Mode!

M

Mike

Hi,

I am having problems with my program, the problem is it will not put
the datagrid into edit mode.

The .aspx page has the following code in it : -

<asp:datagrid id="DataGrid2" runat="server"
OnEditCommand="DEDR_Edit2"></asp:datagrid>

The columns for the datagrid are created dynamically (code for this on
request) including the column giving the user the option to Edit the
grid. When the user clicks "edit" the page refreshes i.e post backs
but the user cannot edit the data, no text boxs. The EditTemplate is
not activated.

Using Visual Studio I have put a break point in the function which is
in the .aspx.cs file.

protected void DEDR_Edit2(object sender, DataGridCommandEventArgs e)
{
DataGrid2.EditItemIndex = Convert.ToInt32(e.Item.ItemIndex);
DataGrid2.DataSource = dsRota.Tables["dtRota_Display"];
DataGrid2.DataBind();
}

and it does not execute this code. This explains why there it does
not go into edit mode. But why is it not going into this function? If
I exclude it from the code, the compiler has a moan about not finding
DEDR_Edit2! So it knows it is there!

Please help!

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top