Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

Question about Datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 15 Jul 2005 23:08 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.