473,387 Members | 1,553 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,387 software developers and data experts.

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="WebForm1.aspx.cs"
AutoEventWireup="true" Inherits="DataListTest.WebForm1" %>
......

<asp:DataList id="DataList1" style="Z-INDEX: 101; LEFT: 296px;
POSITION: absolute; TOP: 152px"
runat="server" BorderColor="Black" BorderWidth="1px"
OnItemCommand="DataList1_ItemCommand">
<HeaderTemplate>
<asp:Button id="Button1" runat="server" Text="Click Me"
CommandName="Button_Click"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Field1") %>
<br>
<asp:LinkButton id="Button1" runat="server" Text="Button"
CommandName="Button_Click"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
.......

public void DataList1_ItemCommand(object source,
System.Web.UI.WebControls.DataListCommandEventArgs e)
{
Label1.Text="Button Event Here!";
DataList1.DataSource=DataSetSearch();
DataList1.DataBind();
}

Neil

Nov 19 '05 #1
1 1519
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
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...
1
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 :...
1
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...
1
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...
3
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...
10
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...
3
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....
0
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...
0
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....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.