Hello,
I am trying to add an EditCommand Button to a datagrid. If I
programmaticall y add the button, like this:
Dim eb As EditCommandColu mn
eb = New EditCommandColu mn
With eb
.ButtonType = ButtonColumnTyp e.PushButton
.EditText = "Edit"
.UpdateText = "Update"
.CancelText = "Cancel"
.ItemStyle.Hori zontalAlign = HorizontalAlign .Center
.HeaderStyle.Bo rderStyle = BorderStyle.Non e
End With
prmDataGrid.Col umns.Add(eb)
I have no problems at all.
However, if I simply add a static button at design time, like this:
<Columns>
<asp:EditComman dColumn ButtonType="Pus hButton" UpdateText="Upd ate"
CancelText="Can cel" EditText="Edit" ></asp:EditCommand Column>
....other columns here...
</Columns>
Then when I actually click my Edit button, my code-behind doesn't
fire. I am not altering my datagrid as all. My datagrid control
looks like this:
<asp:datagrid Width="75%" id="dgTest" runat="server"
GridLines="Hori zontal" AutoGenerateCol umns="False"
OnEditCommand=" dgTest_EditComm and">
<HeaderStyle CssClass="Minor Titles"></HeaderStyle>
<Columns>
....
</Columns>
</asp:datagrid>
I'm not sure why my function 'dgTest_EditCom mand' will work if I
programmaticall y add the EditCommandButt on but will not work when I
use a static button.
Any ideas?
Thanks,
Steve