[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Call a control's postback in client script

Eidolon

2/13/2004 4:22:00 PM

Hi,

I have a table, where i want each cell to be clickable in its entirety to do
a postback. Each cell shows a product special, with description, mfgpn,
price, and a product image. I made the image an asp:imagebutton, which when
clicked, will do a postback to load the product specsheet. I want the entire
cell to do this onclick. What i tried was:

<script>
function clickBack<%=prodnum%>(){
__dopostback('<%=imgImage.ClientID%>','');
}
</script>
<table onclick="clickBack<%=prodnum%>()">
<tr><td>
other contents here
<asp:imagebutton id=imgImage runat=server></asp:imagebutton>
</td></tr>
</table>

The code works and does the postback, but it doesnt actually call the
OnClick handler for imgImage.
Thanks in advance,
- Eidolon.


1 Answer

Joe

2/13/2004 6:51:00 PM

0

If you are databinding thismay do it...

protected void DataGrid1_ItemDataBound(Object sender, System.Web.UI.WebControls.DataGridItemEventArgs e

...

e.Item.Cells[0].Attributes.Add("onclick", "javascript:__doPostBack('','');)

....

Joe