473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Button in footer of datagrid not causing itemcommand event?

Anyone know what could be the problem? I gave the button in the footer
a command name but when the button is clicked the datagrid_itemcommand
event is never fired (tracing it in the debugger)? It is strange...
All buttons in the item list work and cause the event... Just not my
footer button... I added the button in the footer template of the
template column in question.

<FooterTemplate>
<asp:Button id="btnAddCategory" CommandName="Insert"
runat="server" CssClass="button" Text="Add Category"
CausesValidation="false"></asp:Button>
</FooterTemplate>

Any ideas? Thanks.
Nov 18 '05 #1
3 2701
Hi,

Why don't you simply attach a handler to the click event of the button?

Greetings
Martin
"Utter Newbie" <da***@yabbahey.com> wrote in message
news:bs********************************@4ax.com...
Anyone know what could be the problem? I gave the button in the footer
a command name but when the button is clicked the datagrid_itemcommand
event is never fired (tracing it in the debugger)? It is strange...
All buttons in the item list work and cause the event... Just not my
footer button... I added the button in the footer template of the
template column in question.

<FooterTemplate>
<asp:Button id="btnAddCategory" CommandName="Insert"
runat="server" CssClass="button" Text="Add Category"
CausesValidation="false"></asp:Button>
</FooterTemplate>

Any ideas? Thanks.

Nov 18 '05 #2
The headers and footers are not in the DataGridItemCollection. You'll
have to add an explicit handler as Martin suggested.

--
Scott
http://www.OdeToCode.com/

On Mon, 04 Oct 2004 23:29:36 -0600, Utter Newbie <da***@yabbahey.com>
wrote:
Anyone know what could be the problem? I gave the button in the footer
a command name but when the button is clicked the datagrid_itemcommand
event is never fired (tracing it in the debugger)? It is strange...
All buttons in the item list work and cause the event... Just not my
footer button... I added the button in the footer template of the
template column in question.

<FooterTemplate>
<asp:Button id="btnAddCategory" CommandName="Insert"
runat="server" CssClass="button" Text="Add Category"
CausesValidation="false"></asp:Button>
</FooterTemplate>

Any ideas? Thanks.


Nov 18 '05 #3
Made a newbie mistake (Hence my name). When I was testing I had my
poplulatedatagrid method in the page_load event. But I hadn't put it
in a if(!Page.IsPostBack)... So the button event was firing but my
datagrid was begin rewritten each time so the event was wiped out it
seems...

So it does work without having to attach a handler explicitly as long
as you have a commandname property set. Although I did try attaching
a handler explicitly as well but obviously same effect because it was
begin written over each time... Sorry for wasting peoples time. Thanks
for the suggestions though.. Might come in handy somewhere down the
line. :)
Nov 18 '05 #4

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

Similar topics

3
by: Chris | last post by:
Hi Folks, well I have this "small" problem with the footertemplate in a datalist. I added a button and a textbox to update the db with the given String of the Textbox. I already searched for...
2
by: sri_san | last post by:
Hello group, I have a datagrid(dg) and a couple of buttons outside the dg( 'New'& 'Done'). Have a 'save' button inside the dg that responds to itemcommand event. On a 'New' button click, the...
1
by: Stu | last post by:
Hi, I have a button in the footer of a datagrid that sometimes does not tigger the item command. The page is quite large & has a number of homegrown controls in it. Has anyone come across this...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.