Call a control's postback in client script

E

Eidolon

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.
 
J

Joe

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top