Hi,
I have form with datagrid. This is what my form tag looks like,
<form runat="server">
<asp:label runat="server" id="lblMessage" />
<asp:DataGrid runat="server" id="articleList"
DataKeyField="FullName"
OnItemDataBound="articleList_ItemDataBound"
OnEditCommand = "articleList_Edit"
OnCancelCommand = "articleList_Cancel"
OnUpdateCommand = "articleList_Update"
OnDeleteCommand="articleList_DeleteFile"
OnItemCommand="articleList_DownloadFile">
<Columns>
<asp:EditCommandColumn
ButtonType="PushButton"
HeaderText = ""
EditText = "Rename"
CancelText = "Cancel"
UpdateText = "Update" />
<asp:ButtonColumn Text="Delete" ButtonType="PushButton" HeaderText=""
CommandName="Delete" />
<asp:ButtonColumn Text="Download" ButtonType="PushButton" HeaderText=""
CommandName="Download" />
<asp:BoundColumn DataField="Name" HeaderText="File Name" />
<asp:BoundColumn DataField="LastWriteTime" DataFormatString="{0:d}"
HeaderText="Last Write Time" ReadOnly="true"
runat="server" />
<asp:BoundColumn DataField="Length" DataFormatString="{0:#,### bytes}"
HeaderText="File Size" ReadOnly="true"
runat="server" />
</Columns>
</asp:DataGrid>
</form>
The Edit and Delete buttons work the moment I take out the following two
lines,
OnItemCommand="articleList_DownloadFile"
And
<asp:ButtonColumn Text="Download" ButtonType="PushButton" HeaderText=""
CommandName="Download" />
It appears that when the above lines are part of the form, when I click the
Edit button, the control doesn't even go in the event handler
articleList_Edit.
Can someone give me some idea as what could be wrong here? Is somthing wrong
with my form tag? Is it beacsue OnItemDataBound, OnEditCommand,
OnCancelCommand, OnUpdateCommand, OnDeleteCommand and OnItemCommand don't
work if together?
Thanks in advance for your time and help.
Green
Yunus Emre ALPÖZEN [MCSD.NET] - 16 Jul 2005 09:12 GMT
Hi,
EditCommand, DeleteCommand, SelectCommand, CancelCommand, and UpdateCommand
all of these commands are ItemCommands. It is expected behaviour to raise
ItemCommand every time..
So What should u do? In your case u should check CommandName whether it is
"Download". CommandName can be accessible via argument parameter.

Signature
HTH
Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET
> Hi,
>
[quoted text clipped - 55 lines]
>
> Green