H
Homa
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
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