Wire up an edit column programmatically (dataGrid)

RonaldoPartrica

New Member
&nbsp;<BR> <BR> Search Find A Forum Keyword Search<BR> Find An Expert Advanced Search <BR> <BR>Home > Forum Areas > Programmers > Graphics & Web Tools > Microsoft: ASP.NET Forum <BR>programmatically adding an edit column<BR>thread855-285943 <BR> <BR> <BR><BR>Read<BR>New Posts Reply To<BR>This Thread <BR>E-mail It <BR>Print It Next<BR>Thread <BR>link9 (Programmer) Jun 3, 2002 <BR>Hello all --<BR><BR>Making a first shot at adding an edit column through code, and can't seem to get the event handler to fire.<BR><BR>The following is my datagrid declaration:<BR><BR><asp:datagrid id="dgUsers" runat="server" OnEditCommand="DataGrid_Edit" OnDeleteCommand="DataGrid_Delete" /><BR><BR>and here's the code that adds the edit column:<BR><BR>Dim editColumn As New System.Web.UI.WebControls.EditCommandColumn()<BR>editColumn.HeaderText = "Edit"<BR>editColumn.EditText = "Edit"<BR>editColumn.ButtonType = ButtonColumnType.LinkButton<BR>dgUsers.Columns.Add(editColumn)<BR><BR><BR>However, the DataGrid_Edit function is not fired when someone clicks the edit button. However, it is fired if I add it like so to the declaration:<BR><BR><asp:datagrid id="dgUsers" runat="server" OnEditCommand="DataGrid_Edit" OnDeleteCommand="DataGrid_Delete"><BR><Columns><BR><asp:EditCommandColumn ButtonType="LinkButton" EditText="Edit" HeaderText="Edit" /><BR></Columns><BR></asp:datagrid><BR><BR><BR>Anyone see what I'm doing wrong here? What must I do to wire the event up?<BR><BR>Thanks! <BR>paul <BR> <BR>
 
Back
Top