473,698 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ItemCommand of Datagrid within a user control will not fire.

I have a user control contain one datagrid. this datagrid contains one
button column with commandName "Review", I have event handler
datagrid_ItemCo mmand to handle this event and also wired the event when
initial. but when I put this user control in a web form, click the
review link(it is linkbutton) will not fire the event. Any one have any
idea what is the problem. Thanks a lot!
Nov 17 '05 #1
3 2498
I would check the InitializeCompo nent method to see if the event handler for
this event is included.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Li Zhang" <zh********@gma il.com> wrote in message
news:u2******** ******@TK2MSFTN GP15.phx.gbl...
I have a user control contain one datagrid. this datagrid contains one
button column with commandName "Review", I have event handler
datagrid_ItemCo mmand to handle this event and also wired the event when
initial. but when I put this user control in a web form, click the
review link(it is linkbutton) will not fire the event. Any one have any
idea what is the problem. Thanks a lot!
Nov 17 '05 #2
Thanks David for your quick reply. I checked the InitializeCompo nent
method already. Here is the InitializeCompo nent method:

private void InitializeCompo nent()
{
this.imageDataG rid.ItemCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.i mageDataGrid_It emCommand);
this.Load += new System.EventHan dler(this.Page_ Load);
}

And I have my event handler:
private void imageDataGrid_I temCommand(obje ct sender,
DataGridCommand EventArgs e)
{
//some code here.
}

I don't know what is the problem. Thanks.

David Lloyd wrote:
I would check the InitializeCompo nent method to see if the event handler for
this event is included.


Nov 17 '05 #3
Li Zhang wrote:
Thanks David for your quick reply. I checked the InitializeCompo nent
method already. Here is the InitializeCompo nent method:

private void InitializeCompo nent()
{
this.imageDataG rid.ItemCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.i mageDataGrid_It emCommand);

this.Load += new System.EventHan dler(this.Page_ Load);
}

And I have my event handler:
private void imageDataGrid_I temCommand(obje ct sender,
DataGridCommand EventArgs e)
{
//some code here.
}

I don't know what is the problem. Thanks.

David Lloyd wrote:
I would check the InitializeCompo nent method to see if the event
handler for
this event is included.


I found my problem. I made a very stupid mistake. when page postback the
user control did not load at all. I should load this control in
Page_Load event not in an other event handler function. Thanks guys!
Nov 17 '05 #4

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

Similar topics

0
1403
by: Daniel Armstrong | last post by:
Hello, I have a usercontrol that I have built that has a single generic datagrid. When setting up the inital properties I build the template columns for the datagrid dynamically so it can display as readonly or readwrite. The readwrite displays link buttons for edit, update, cancel and delete buttons. When I click on a edit link button the page using the usercontrol will begin it's page load event and then the usercontrol page load...
4
2001
by: Steven | last post by:
Hi there, I am having a weird problem. I have a datagrid with both an ItemCommand and a SortCommand. It was working fine until a day ago. Now, whenever I click a column to fire the SortCommand, the ItemCommand gets fired instead. In the debugger, e.CommandName is equal to "Sort", even though it is being handled by the ItemCommand event. If I remove the ItemCommand event handler, it works fine, but as soon as I put it back in the...
2
12009
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter" runat="server" commandname="Filter" CommandArgument='<%#
0
1289
by: Solomon Shaffer | last post by:
I am trying to add some link buttons to a datagrid template column at runtime and trying to wire these buttons up to the ItemCommand event (or any event when clicked!). The ItemCommand event works fine if I add the controls at design time in the HTML, but does not seem to catch when I add the control dynamically in the code behind. The datagrid renders just fine, just no ItemCommand event... I have included some code snipplets below. Any...
0
1145
by: Mark Kelly | last post by:
(originally posted on framework.aspnet.datagridcontrol) Hi, I don't seem to be able to get a imagebutton (within a template column) to fire an itemcommand event when clicked. Looking through this NG, it seems like the same problem has been raised many times, except in most cases the problem occurs as the datagrid's databind method is being called on Postback - something that definately isn't happening in my code. I also have a standard...
3
5004
by: sri_san | last post by:
Hello Group, I use a datagrid with a linkbutton to delete the selected row. Added javascript confirm dialogue box in itembound event. The itemCommand event does not seem to fire when I debug the application. Any ideas? Code outline below: <asp:datagrid id="dbgrdCandidate_List" ForeColor="Black" runat="server"
2
3374
by: Deepesh | last post by:
Good day, I have a specific case of the DataGrid in my solution which is causing the ItemCommand Event Not Firing. So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX file and .CS file. When I initialize my .CS file, in that code there is a method that goes: Page.LoadControl(FILENAME) Which associates a .ascx file with my .CS file, allowing me to plug in any
4
4157
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up any answers?? Regards,
1
3958
by: shantanu_kush | last post by:
Hi there, I am using a DataList in a composite control. The DataList has an Custom ItemTemplate(ITemplate) which adds a Button to the DataList Item as shown in the code below : public class DatalistItemTemplate : ITemplate { public void InstantiateIn(Control container)
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
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...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
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
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.