473,324 Members | 2,214 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,324 software developers and data experts.

DataList - Events Not Firing

First time trying to use the Datalist and I can not seem to get the events to
fire.

I set up my Data List control and I identify the event for the
"OnEditCommand". I also set up an "<ItemTemplate>" in which I place a
ASP:Button control in and I specify the "CommandName" property for this
button to be "edit". I ensure that my control has the Datasource propery set
to my DataTable.
When I press the button in the DataList control, the Form load even fires
and I retrieve my DataTable from my viewState and then re-associated that
datatable to the DataSource of my Datalist control, but the Event never fires.

I can not get the "OnItemCommand" to fire either.

Any ideas as to what I am doing wrong?
Nov 19 '05 #1
1 1889
Hi,

are you setting the data source on every postback? If that's the case,
that's the source of your problems. You should ensure it is set (DataList is
databound) only for initially in Not Page.IsPostBack check in Page_Load.
Later on the rebinding happens in postback events or as is needed, however
you shouldn't bind the dataList in Page_Load on every request as that clears
events to be raised for the control in question.

E.g

Public Sub Page_Load(...) Handles MyBase.Load
If Not Page.IsPostBack Then
'Binding the DataList here
BindDataList()
End If
End Sub

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
First time trying to use the Datalist and I can not seem to get the events to fire.

I set up my Data List control and I identify the event for the
"OnEditCommand". I also set up an "<ItemTemplate>" in which I place a
ASP:Button control in and I specify the "CommandName" property for this
button to be "edit". I ensure that my control has the Datasource propery set to my DataTable.
When I press the button in the DataList control, the Form load even fires
and I retrieve my DataTable from my viewState and then re-associated that
datatable to the DataSource of my Datalist control, but the Event never fires.
I can not get the "OnItemCommand" to fire either.

Any ideas as to what I am doing wrong?

Nov 19 '05 #2

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

Similar topics

3
by: Kenneth | last post by:
Hi there, The OnItemCommand in my datalist is acting very weirdly, the first time the page is loaded(or anything on the datalist is clicked for the first time) its firing only once, but after...
2
by: Jim Heavey | last post by:
I have a datalist control and when edit mode, I have three buttons, one for delete, one for cancel and one for Update. My Update button is not causing anything to happen. The other two events...
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...
0
by: manu_srinivasa | last post by:
:( Here is my design, we have user control placed in a aspx page. within user control, i am having datalist, within datalist i am placing radio button. On click of radio button, i need to...
1
by: Paul L | last post by:
Hi, I have an issue with the OnSelectedIndexChanged event not firing for a DropDownList control which is in the ItemTemplate of a DataList. I have made an exact copy of the DropDownList control,...
3
by: Patrick Olurotimi Ige | last post by:
Can i have a Button in a Datalist? The button is for posting a form to the the Database FOr example:- <ASP:DataList id="heading0" RepeatLayout="Flow" RepeatDirection="Horizontal" ...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
1
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...
1
by: rajkumarbathula | last post by:
Hi I am struckup with a big issue. ie., On my Page i am rendering 2 dynamic datalists each has dynamic link buttons. my problem is: i am not able to handle ItemCommandEvent of both the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.