一个小问题。
张新林 2003-08-19 02:57:40 这样一个button
<asp:button id="BtnDel" runat="server" Text="Delete"></asp:button>
为了点击它前给用户提示'are you sure delete?'
在page-load事件加入以下代码
string script = "return confirm('Are you sure you wish to delete this item?');";
btnDelete.Attributes.Add("onclick", script);
发现有些页面能工作,有些页面不能工作。
在IE上ViewSource时发现区别是:
<input type="submit" name="BtnDel" value="Delete" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="BtnDel" class="button" />
有onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
asp.net自动生成的这一段的页面不能工作。
对比两张不同form没发现区别。
怎么解决呢?