Hi,
I'm using a datalist with an ImageButton that, when clicked, provides further information from database and displays it in a DetailsView and FormView. Because a video is playing at the same time, I need it to be AJAXified so that when an imagebutton is clicked in the datalist, the update panel updates asynchronously. I heard that you need to use RegisterAsyncPostBackControl to register each imagebutton as an async control, but I'm still having troubles because it keeps posting back whenever a button is click. I think that either I'm not provoking the method correctly, or its being provoked in the wrong place.
Thanks in advance.
C# Code:
Code:
protected void selectFrog_Click(object sender, CommandEventArgs e)
{
AccessDataSource AccessDataSource1 = new AccessDataSource();
AccessDataSource1.DataFile = "~/App_Data/EMS1.mdb";
AccessDataSource1.SelectCommand = "SELECT * FROM [SpeciesFrog] WHERE ([FrogID] = " + e.CommandArgument.ToString() + ")";
AccessDataSource1.ID = "AccessDataSource1";
FormView1.DataSource = AccessDataSource1;
FormView1.DataBind();
DetailsView1.DataSource = AccessDataSource1;
DetailsView1.DataBind();
DataList1.DataBind();
this.UpdatePanel1.Update();
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
ImageButton imgButton = (ImageButton)e.Item.FindControl("FrogThumb");
ScriptManager1.RegisterAsyncPostBackControl(imgButton);
int i = ScriptManager1.Controls.Count;
}