473,772 Members | 3,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataList bubble event with Buttons

I can't get the event handling to work on Button or ImageButton inside
the header of a DataList. If I change Button to LinkButton it works
fine. Has anyone had this problem? I'm using c# code behind. Here
are the important parts of the code:

<%@ Page language="c#" Codebehind="Web Form1.aspx.cs"
AutoEventWireup ="true" Inherits="DataL istTest.WebForm 1" %>
......

<asp:DataList id="DataList1" style="Z-INDEX: 101; LEFT: 296px;
POSITION: absolute; TOP: 152px"
runat="server" BorderColor="Bl ack" BorderWidth="1p x"
OnItemCommand=" DataList1_ItemC ommand">
<HeaderTemplate >
<asp:Button id="Button1" runat="server" Text="Click Me"
CommandName="Bu tton_Click"></asp:Button>
</HeaderTemplate>
<ItemTemplate >
<%# DataBinder.Eval (Container.Data Item, "Field1") %>
<br>
<asp:LinkButt on id="Button1" runat="server" Text="Button"
CommandName="Bu tton_Click"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
.......

public void DataList1_ItemC ommand(object source,
System.Web.UI.W ebControls.Data ListCommandEven tArgs e)
{
Label1.Text="Bu tton Event Here!";
DataList1.DataS ource=DataSetSe arch();
DataList1.DataB ind();
}

Neil

Nov 19 '05 #1
1 1544
Oh, take out that LinkButton line. That's a typo. - Neil

Nov 19 '05 #2

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

Similar topics

2
14332
by: Chris Fink | last post by:
Hello, I have a datalist that contains an asp button. I have the need to pass a value that is bound to my datalist along the button when the on_click event is fired. My datalist creates a button for each row in my datasource, so each button needs to pass a unique value. My questions are: 1. How do I pass the value with the button without making it visible on the button or form. 2. Is there a way to grab this value in the button's...
1
1261
by: Jenny C. | last post by:
Hi Guys I have this problem: I'm trying to put a LinkButton inside a Datalist. But I can't add an event handle for the button. If I double click on the LinkButton, I get forwarded to the method : dtlMyDataList_SelectedIndexChanged but that method is not fired when I click on one of the buttons at runtime How do I go about this? Or is it a bad idea to put a Link Button in a DataList in the first place thanks
1
10930
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside my datalist has an id of "Datagrid3". dgChild comes back with "Nothing" while debugging. Here is my code in the itemdatabound event for the datalist: <code>
1
3627
by: bill yeager | last post by:
I have a radiobuttonlist inside a datalist. I also have a datagrid inside the datalist. The data and the controls are rendering just fine. However, I need to find these controls inside the datalist in order to programatically perform some logic. I have the following in my HTML which is inside the ItemTemplate of the datalist:
3
2761
by: moondaddy | last post by:
using vb.net 1.1 I have a datalist and in it's item template I have 2 buttons, 'edit' and 'ShipToThisAddress'. The edit button works fine and it opens up the edit template as it works with the edit command. But the how do I wire ShipToThisAddress button? Its going to submit the address ID to the database and do a redirect to another page. In the process of doing this, it will need to get the row index in the datalist so I can get the...
10
2856
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
3
5408
by: Sourav Dutta Gupta | last post by:
I am having some problem regarding radiobutton inside a datalist. I want to have a radiobutton on each row of my datalist. I want to check a particular button, all the other would remain unchecked. Also I want to get the checked value from my code behind. I have tried with the following code. Each time I click the button to find the value of the radio button, getting an error "Object reference is not set". HTML ====
0
3948
by: Isz | last post by:
PROBLEM: This problem is related to the postback and handling events correctly. BACKGROUND: I have a datalist which acts as a tabbes list with horizontal layout. This datalist is bound to a strogly typed collection I called TabCollection which is a collevtion of items called tab. Each tab is as follows:
0
1349
by: Nathan Sokalski | last post by:
I have a DataList that contains TextBoxes. I want to postback when the TextChanged event occurs. I have the TextBox's AutoPostBack property set to True, but it does not seem to be doing a postback. I would expect this to bubble up to the DataList's ItemCommand event, but this does not seem to be happening. I will note that the DataList is inside an UpdatePanel, but it should still do the postback. Any ideas why this is not working? Thanks....
0
9454
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
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
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...
1
10038
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
8934
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...
1
7460
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
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
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.