I'm using a div as an Image button, as the ASP Imagebutton was causing a flash on click, no matter what.
The Div click raises a server side event to bind the grid and it works good. Just that the whole page loads. In order not to, I tried to have it as a trigger.
Now, it gives the error - 'div1 being reistered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either InamingContainer,IpostBackDataHandler, or IpostbackEventHandler'
ASPX:<div id="div1" runat="server" class="search"></div>
<asp:UpdatePanel runat="server" updatemode="conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="divSearch" EventName="Click"/>
</Triggers>
<ContentTemplate>
<asp:gridview....../>
</ContentTemplate>
</asp:UpdatePanel>
C#: public partial class Home: System.Web.UI.Page, IPostBackEventHandler
{
protected void Page_Load(object sender, EventArgs e)
{
div1.Attributes["onclick"] = ClientScript.
GetPostBackEventReference(this, "div1_Click");
}
protected void div1_Click()
{
bindGrid();
}
public void RaisePostBackEvent(string eventArgument)
{
if (!string.IsNullOrEmpty(eventArgument))
{
if (eventArgument == "div1_Click")
{
div1_Click();
}
}
}
}
Any way to make this work?