Hi -
I'm actually trying to solve this same problem. Has anyone found any
solution to this? It's driving me nuts!
Thanks!
homaneag@yahoo.com (Homa) wrote in message news:<a9a6fc0b.0311061518.23a16225@posting.google. com>...[color=blue]
> Hi,
>
> I have a Datagrid that uses as a shopping cart and have a checkbox
> template column in it. I can't add both OnCheckedChanged Event and
> onclick client script for it.
>
>
> I want to do two things:
>
> 1. I want the checkbox fires CheckedChanged event. I did this as
> follows:
>
> In the DataGrid:
> <templateColumn>
> ...
> <asp:CheckBox id="chk" runat="server" AutoPostBack=True
> OnCheckedChanged="handler" />
> ...
> </templateColumn>
>
> This works fine.....by itself
>
> 2. I want to show a confirm box:
>
> In the same CheckBox:
> <asp:CheckBox ... onclick="javascript
:return confirm('Are you
> Sure?');" />
>
> This again, works fine by itself.
>
> But when these two code goes together. Only the confirm button will
> show without doing the postback.
>
> When I look that the source, I saw both of them use the onclick,
> resulting both javascript combined together:
>
>
> name="dg:_ctl2:chk"
> language="javascript"
> onclick="javascript
:return confirm('Are you
> sure?');__doPostBack('dg$_ctl2$chk','')"
>
>
> Can anyone give me some idea about how to solves this?
>
> Thanks,
> Homa Wong[/color]