Reputation: 157
I have a datalist in my aspx page. In the datalist, there are images displayed. When I click on an image, a bigger version of the image appears in a popup, and in this popup there is a button. On that button, I want to react to a click even without postback. What I'm doing now is not working every time. I am using go
for the item_created
event and __dopostback(btn.id,"onClick")
.
The item_created
event fires when I click on the ok button on the div that displays the image.
Upvotes: 0
Views: 1281
Reputation: 40517
If you mean that ItemCreated
event is firing every time post back is occurring. Please do your databinding only first time when page loads. You can use IsPostBack
property to check if it is a postback or fresh loading of page.
Page_Load(....){
if(!IsPostBack){
LoadData();
}
}
If you do not want to use postback on button click, please use ajax and page methods. You can get more information here: Using jQuery AJAX to directly call page methods.
Upvotes: 1