English 中文(简体)
image光灯的图像
原标题:imagebutton with onclientclick isn t firing onclick event
  • 时间:2011-01-07 21:44:33
  •  标签:
  • asp.net

我有一个形象布局,有背书和立标书。 当我添加“星号”码时,如果我打字的验证通行证(卡回报真实),那么该页似乎只是进行回击(屏幕似乎只是复读),而不是张贴在后台上。 为什么会发生这种情况?

样本:

<asp:ImageButton ID="imgSendInfo" runat="server" SkinID="SendInfo" PostBackUrl="MyUrlOnAnotherSite" onClientClick="javascript:return onFormSubmit(this.form);return document.MM_returnValue" />

最新资料:

因此,我决定改变“Im”自称为“多重职能”后起的作用。 我在此更新了法典。 现在所做的一切都是验证单一文本箱,归还真实或虚假。 即便是这一简单的功能,也使LURL永远不会被召唤。 难道它会与我试图呼吁恢复真实或虚假的职能有关吗?

我的验证职能:

function valForm() {
    if (document.getElementById( FName ).value ==   ) {
        alert( no );
        return false;
    }
    else {
        alert( yes );
        return true;
    }
}

我的图像Button:

<asp:ImageButton ID="imgSendInfo" runat="server" SkinID="SendInfo" PostBackUrl="SetOnCodeBehind" onClientClick="javascript:return valForm();" />
最佳回答

缩略语 我重申从中线浮标的返回声明,因为返回是背后的情况。 随后,我又在网页上添加了必要的实地验证器,但没有显示任何文字。 这样,有两套验证(波罗),但第一份显示我的警示(即客户如何要求进行验证),第二份防止表格张贴。

我的形象布顿:

<asp:ImageButton ID="imgSendInfo" runat="server" SkinID="SendInfo" PostBackUrl="SetOnCodeBehind" ValidationGroup="enroll" CausesValidation="true" onClientClick="javascript:onFormSubmit(this.form);document.MM_returnValue;" />

我要求的实地验证小组:

<asp:RequiredFieldValidator ID="reqVal1" runat="server" ErrorMessage="" ValidationGroup="enroll" ControlToValidate="FName" InitialValue="" />
<asp:RequiredFieldValidator ID="reqVal2" runat="server" ErrorMessage="" ValidationGroup="enroll" ControlToValidate="LName" InitialValue="" />
问题回答

Did you know that your onClientClick js-function returns twice? return document.MM_returnValue never gets reached.

页: 1 您甚至可以确认服务器上上上页的正确性:

If Page.PreviousPage.IsValid Then
      Handle the post back
Else
    Response.Write("Invalid")
End If

详情:





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签