hi, sure you can. Try the following code i used to make a simple example.
Regards,
Alessandro Zifiglio
http://www.AsyncUI.net
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void ImageButton1_Command(object sender, CommandEventArgs e)
{
/*do something here, it will fire only the first time the image
button is clicked.
the next time onwards, the following jscode will be injected
which cancels the submit and
instead makes it expand and collapse the the li node with id
'collapsible1'
*/
collapsible1.InnerText = "some stuff for the body, coming from your
database";
ImageButton1.Attributes.Add("onclick",
"document.getElementById('collapsible1').style.vis ibility =
((document.getElementById('collapsible1').style.vi sibility == 'visible') ?
'hidden' : 'visible'); return false");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ul style="list-style-type:none">
<li>head <asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/url/to/your/image" OnCommand="ImageButton1_Command" /></li>
<li id="collapsible1" runat="server"
style="visibility:visible"></li>
</ul>
</div>
</form>
</body>
</html>
<> ha scritto nel messaggio
news: ups.com...
> Hi people
>
> Does anyone know how whether there is any property, way or trick to
> stop the postback of a image button??
>
> I need the image button to change its behavour after the first click.
> The image button expands an area that contains more information, The
> first click would be a postback with a database query to get some extra
> info and put it in expandable area.
> The second click and consecutives would just collapse and expand this
> expandable area
>
> Does anyone know if this is posible with just jusing one image button??
>
> Thank you!
>