473,722 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about Datagrid

Joe
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="F ullName"
OnItemDataBound ="articleList_I temDataBound"
OnEditCommand = "articleList_Ed it"
OnCancelCommand = "articleList_Ca ncel"
OnUpdateCommand = "articleList_Up date"
OnDeleteCommand ="articleList_D eleteFile"
OnItemCommand=" articleList_Dow nloadFile">
<Columns>
<asp:EditComman dColumn
ButtonType="Pus hButton"
HeaderText = ""
EditText = "Rename"
CancelText = "Cancel"
UpdateText = "Update" />
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton" HeaderText=""
CommandName="De lete" />
<asp:ButtonColu mn Text="Download" ButtonType="Pus hButton" HeaderText=""
CommandName="Do wnload" />
<asp:BoundColum n DataField="Name " HeaderText="Fil e Name" />
<asp:BoundColum n DataField="Last WriteTime" DataFormatStrin g="{0:d}"
HeaderText="Las t Write Time" ReadOnly="true"
runat="server" />
<asp:BoundColum n DataField="Leng th" DataFormatStrin g="{0:#,### bytes}"
HeaderText="Fil e 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_Dow nloadFile"

And

<asp:ButtonColu mn Text="Download" ButtonType="Pus hButton" HeaderText=""
CommandName="Do wnload" />

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_Edi t.

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

Nov 19 '05 #1
1 1325
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.

--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:EF******** *************** ***********@mic rosoft.com...
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="F ullName"
OnItemDataBound ="articleList_I temDataBound"
OnEditCommand = "articleList_Ed it"
OnCancelCommand = "articleList_Ca ncel"
OnUpdateCommand = "articleList_Up date"
OnDeleteCommand ="articleList_D eleteFile"
OnItemCommand=" articleList_Dow nloadFile">
<Columns>
<asp:EditComman dColumn
ButtonType="Pus hButton"
HeaderText = ""
EditText = "Rename"
CancelText = "Cancel"
UpdateText = "Update" />
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton" HeaderText=""
CommandName="De lete" />
<asp:ButtonColu mn Text="Download" ButtonType="Pus hButton" HeaderText=""
CommandName="Do wnload" />
<asp:BoundColum n DataField="Name " HeaderText="Fil e Name" />
<asp:BoundColum n DataField="Last WriteTime" DataFormatStrin g="{0:d}"
HeaderText="Las t Write Time" ReadOnly="true"
runat="server" />
<asp:BoundColum n DataField="Leng th" DataFormatStrin g="{0:#,### bytes}"
HeaderText="Fil e 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_Dow nloadFile"

And

<asp:ButtonColu mn Text="Download" ButtonType="Pus hButton" HeaderText=""
CommandName="Do wnload" />

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_Edi t.

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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2277
by: AC | last post by:
Any reason i'm having trouble with: DataGrid1.Columns(7).ItemStyle.HorizontalAlign = HorizontalAlign.Right I'm trying to directly set the column alignment of a datagrid created at runtime.. AC
1
1444
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but the explanation is not useful. Please spend sometime reviewing this question and its answer. Any guide on this matter would be greatly appreciated. Question: Your Web form includes a DropDownList control named ddlStudent that displays a...
0
978
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but the explanation is not useful. Please spend sometime reviewing this question and its answer. Any guide on this matter would be greatly appreciated.
5
1371
by: Manny Chohan | last post by:
i have the following situatin: In datagrid i click on hyperlink button to navigate to the detail.aspx page which displays detailed information regarding item id passed from datagrid. Can i put arrows(up/down) on detail.aspx so that i can retrieve next/previous corresponding item in datagrid? Is this possible? Can someone recomend any article which explains how to achieve this in C#? Thanks Manny
6
1813
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to...
0
1538
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
0
1404
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
2
2008
by: JohnR | last post by:
I have a question on bindingcontext, bindings, and controlbindingscollection. I understand the very basic idea, and I think I should be able to do this, but I'm not sure how. First problem: I have a combobox and a textbox on a form. I also have a "Customers" table loaded into a dataset. I set the combobox.datasource to the table in the dataset, and add a binding to the text property of the combobox for the 'Name' field. I also add...
1
316
by: amber | last post by:
I have a form, with multiple tabs. Each tab contains 1 datagrid except for the last tab which contains 2 datagrids. I have a toolbar that I use for the entire form. When the 'delete' button is pressed, and any but the last tab is active, it prompts the user, then deletes the currently selected row from the focussed datagrid. My problem lies with the last tab. I have 2 datagrids on my last tab. I'd like the user to be able to click the row...
0
2079
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.