C1Dialog DialogButton OnClientClick event firing on load

Posted by: drlarsen on 10 September 2017, 11:41 am EST

  • Posted 10 September 2017, 11:41 am EST

    I have updated to the latest available ASP.NET Wijmo and now I'm having a problem with the DialogButton's OnClientClick event. For some reason, when the page loads, the button's OnClientClick event is fired. Afterwards, the button's OnClientClick event doesn't fire when clicked.

    As a test, I created a new page, added a C1Dialog via the Design View. I then added a DialogButton via the C1Dialog's properties in Design View. I attached a simple "alert('test')" script to the OnClientClick event. The alert is fired as soon as the page is loaded.


    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Dummy.aspx.vb" Inherits="Admin_Dummy" %>
    <%@ Register Assembly="C1.Web.Wijmo.Controls.4" Namespace="C1.Web.Wijmo.Controls.C1Dialog" TagPrefix="wijmo" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <wijmo:C1Dialog ID="C1Dialog1" runat="server" CloseOnEscape="False"
    Show="blind">
    <Buttons>
    <wijmo:DialogButton OnClientClick="alert('test')" Text="Test" />
    </Buttons>
    <Content>
    text
    </Content>
    </wijmo:C1Dialog>
    </div>
    </form>
    </body>
    </html>
  • Replied 10 September 2017, 11:41 am EST

    I realized the problem is because I should be putting a function name in the OnClientClick, rather than a script.


    function testClick() {
    alert('test');
    }


    and


    <wijmo:DialogButton OnClientClick="testClick" Text="Test" />


    Problem solved and updating to the latest version fixed my original issue.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels