163
rated 0 times
[
169]
[
6]
/ answers: 1 / hits: 17823
/ 14 Years ago, thu, october 28, 2010, 12:00:00
actually this code is working well in firefox mozilla but it's not working in IE8
<asp:Button ID=btnSubmit runat=server Text=Submit CssClass=btnPrimary OnClientClick=return doSubmit('this');
OnClick=btnSubmit_Click />
<script type=text/javascript>
function doSubmit()
{
var ansLength = oDOM.body.innerText.trim().length;
if (ansLength == 0 && smielyPresent == -1)
{
alert(you cannot submit blank answer);
return false;
}
}
</script>
protected void btnSubmit_Click(object sender, EventArgs e)
{
// i am doing some stuff
}
here i want to prevent postback when answerlength == 0 ;
but when answer length ==0
then it alert alert(u can't submit blank answer)
message and postback to server io want to prevent it how i do ?
More From » c#