locked
Click event not working?? RRS feed

  • Question

  • User1326971216 posted

    I have a textbox inside accordion panel in which I display message on textbox change event using modalpopup extender and while click on the button inside modalpopup I have apply javascript to clear textbox but it's not working my javascript code is

    <script type="text/javascript">
    function OnClick() {
    if ($("BtnOK").click()) {
    document.getElementById("TBoxAccountCode").value = "";
    document.getElementById("TBoxAccountCode").focus();
    }
    }
    </script>

    Accordio Panel

    <asp:AccordionPane ID="AccordionPane1" runat="server">
    <Header>Account Detail</Header>
    <Content>
    <table>
    <td>
    <asp:Label ID="LblAccountCode" runat="server" Text="Account Code :"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="TBoxAccountCode" runat="server" Width="175px" style="text-transform:uppercase" OnTextChanged="TBoxAccountCode_TextChanged" AutoPostBack="true"></asp:TextBox>
    </td></content>

    ModalPopup Extender

    <asp:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="t1" DisplayModalPopupID="TextDiplicationPUP"></asp:ConfirmButtonExtender>
    <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="t1" PopupControlID="Panel7" CancelControlID="BtnOK" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel7" runat="server" CssClass="modalPopup">
    <div class="header">MESSAGE BOX</div>
    <table style="border:Solid 2px #D46900; width:auto; height:auto">
    <tr>
    <td colspan="2" style="padding:5px; font-family:Calibri">
    <asp:Label ID="Label2" runat="server" Text="Record does not exist.Please Select Proper Record!!!"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    <tr>
    <td> </td>
    <td style="padding-right:15px">
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:ImageButton ID="BtnOK" runat="server" ImageUrl="~/Styles/images/okbtn.png" Height="16px" Width="55px" OnClientClick="OnClick()" />
    </td>
    </tr>
    </table>

    Wednesday, April 2, 2014 6:27 AM

Answers

  • User1140095199 posted

    Hi,

    I have a textbox inside accordion panel in which I display message on textbox change event using modalpopup extender and while click on the button inside modalpopup I have apply javascript to clear textbox but it's not working my javascript code is

    Change the JS function:

     <script type="text/javascript">
         function OnClick() {
             if ($("BtnOK").click()) {
                 document.getElementById("<%=TBoxAccountCode.ClientID%>").value ="";
                 
                 document.getElementById("<%=TBoxAccountCode.ClientID%>").focus();
             }
         }

    I reproduced and checked it. It's working now. Problem was that at runtime the control id's are rendered differently. So for server controls always use ClientID property to get the control ID.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 3, 2014 3:37 AM

All replies

  • User-228428399 posted

    Where you call the function on your button click event?

    Please try this code instead of your button codes

    <asp:ImageButton ID="BtnOK1" runat="server" ImageUrl="~/Styles/images/okbtn.png" OnClientClick="OnClick()" Height="16px" Width="55px" />

    Wednesday, April 2, 2014 6:37 AM
  • User-1231836060 posted

    Please check the Image button id value..

    In the Inline code Its having "BtnOK1" but in JS having "BtnOK".Change the ID value and check,

    Wednesday, April 2, 2014 6:43 AM
  • User1326971216 posted

    I have change It But not working

    Wednesday, April 2, 2014 7:10 AM
  • User1326971216 posted

    My page Code In which Java Script not working

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmAccountMasters.aspx.cs" Inherits="Form_Masters_FrmAccountMasters" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title></title>
    <link href="../../Styles/css/Modal.css" type="text/css" rel="stylesheet" media="all" />
    <style type="text/css">
    .style6
    {
    width: 199px;
    }
    .style12
    {
    width: 170px;
    }
    .style14
    {
    width: 41px;
    }
    .style17
    {
    width: 187px;
    }
    .style18
    {
    width: 153px;
    }
    .style19
    {
    width: 94px;
    }
    body
    {
    background-color:#D3DEEF;
    }
    </style>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="../../Styles/js/quicksearch.js"></script>
    <script type="text/javascript">
    $(function () {
    $('.search_textbox').each(function (i) {
    $(this).quicksearch("[id*=GRDGodown] tr:not(:has(th))", {
    'testQuery': function (query, txt, row) {
    return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
    }
    });
    });
    });
    </script>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="../../Styles/js/quicksearch.js"></script>
    <script type="text/javascript">
    $(function () {
    $('.search_textbox').each(function (i) {
    $(this).quicksearch("[id*=GRDPartyGroup] tr:not(:has(th))", {
    'testQuery': function (query, txt, row) {
    return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
    }
    });
    });
    });
    </script>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="../../Styles/js/quicksearch.js"></script>
    <script type="text/javascript">
    $(function () {
    $('.search_textbox').each(function (i) {
    $(this).quicksearch("[id*=GRDTransportHelp] tr:not(:has(th))", {
    'testQuery': function (query, txt, row) {
    return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
    }
    });
    });
    });
    </script>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="../../Styles/js/quicksearch.js"></script>
    <script type="text/javascript">
    $(function () {
    $('.search_textbox').each(function (i) {
    $(this).quicksearch("[id*=GRDGroupHelp] tr:not(:has(th))", {
    'testQuery': function (query, txt, row) {
    return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
    }
    });
    });
    });
    </script>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="../../Styles/js/quicksearch.js"></script>
    <script type="text/javascript">
    $(function () {
    $('.search_textbox').each(function (i) {
    $(this).quicksearch("[id*=GRDCommonHelp] tr:not(:has(th))", {
    'testQuery': function (query, txt, row) {
    return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
    }
    });
    });
    });
    </script>

    <script type="text/javascript">
    function OnClick() {
    if ($("BtnOK").click()) {
    document.getElementById("TBoxAccountCode").value = "";
    document.getElementById("TBoxAccountCode").focus();
    }
    }
    </script>

    <script type="text/javascript">
    function EnterEvent(e) {
    if (e.keyCode == 113) {
    __doPostBack('<%=TboxAccountGroup.UniqueID%>', 'OnKeyDown');
    }
    }
    </script>
    <script type="text/javascript">
    function Event(e) {
    if (e.keyCode == 113) {
    __doPostBack('<%=TboxTransportName.UniqueID%>', 'OnKeyDown');
    }
    }
    </script>
    <script type="text/javascript">
    function Event1(e) {
    if (e.keyCode == 113) {
    __doPostBack('<%=TboxPartyGroupName.UniqueID%>', 'OnKeyDown');
    }
    }
    </script>

    <script type="text/javascript">
    function Event2(e) {
    if (e.keyCode == 113) {
    __doPostBack('<%=TboxGodownName.UniqueID%>', 'OnKeyDown');
    }
    }
    </script>


    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>

    <asp:Accordion ID="Accordion1" runat="server" CssClass="accordion" HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent" SuppressHeaderPostbacks="true" TransitionDuration="250"
    FramesPerSecond="40" SelectedIndex="0"
    RequireOpenedPane="false" AutoSize="None" Width="1262px" Height="585px" FadeTransitions="true" >
    <Panes>
    <asp:AccordionPane ID="AccordionPane1" runat="server">
    <Header>Account Detail</Header>
    <Content>
    <table>
    <td>
    <asp:Label ID="LblAccountCode" runat="server" Text="Account Code :"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="TBoxAccountCode" runat="server" Width="175px" style="text-transform:uppercase" OnTextChanged="TBoxAccountCode_TextChanged" AutoPostBack="true"></asp:TextBox>
    </td>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Account Name :" ID="LblAccountName"></asp:label></td>
    <td><asp:textbox runat="server" Width="400px" ID="TboxAccountName" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Account Group :" ID="LblAccountGroup"></asp:label></td>
    <td><asp:textbox runat="server" Width="400px" ID="TboxAccountGroup" style="text-transform:uppercase" onkeydown="return EnterEvent(event)" OnTextChanged="TboxAccountGroup_TextChanged"
    AutoPostBack="true"></asp:textbox></td>
    </tr>

    <tr>
    <td class="auto-style1"><asp:label runat="server" text="Opening Balance" ID="LblOpeningBalance"></asp:label></td>
    <td> <asp:textbox runat="server" Width="175px" ID="TboxOpeningBalance" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="Debit/Credit" ID="LblDebitCredit"></asp:label>
    &nbsp;<asp:textbox runat="server" ID="TboxDebitCredit" Width="75px" style="text-transform:uppercase"></asp:textbox><br />
    </td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Billing Address :" ID="LblBillingAddress"></asp:label></td>
    <td>
    <asp:TextBox ID="TboxBillingAddress1" runat="server" Width="400px" style="text-transform:uppercase"></asp:TextBox><br /></td>
    </tr>
    <tr>
    <td class="auto-style1"></td>
    <td><asp:TextBox ID="TboxBillingAddress2" runat="server" Width="400px" style="text-transform:uppercase"></asp:TextBox></td>
    </tr>
    <tr>
    <td class="auto-style1"></td>
    <td><asp:textbox runat="server" Width="400px" ID="TboxBillingAddress3" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:Label runat="server" Text="Station :" ID="LblStation"></asp:Label></td>
    <td> <asp:textbox runat="server" Width="175px" ID="TboxStation" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="State :" ID="LblState"></asp:label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:textbox runat="server" Width="175px" ID="TboxState" style="text-transform:uppercase"></asp:textbox>
    </td>

    </tr>
    <tr>
    <td class="auto-style1"> <asp:Label runat="server" Text="Pin Code :" ID="LblPinCode"></asp:Label></td>
    <td><asp:textbox runat="server" Width="175px" ID="TboxPinCode" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"><asp:Label runat="server" Text="Phone :" ID="LblPhone1"></asp:Label></td>
    <td><asp:textbox runat="server" Width="175px" ID="TboxPhone1" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="Fax :" ID="LblFax"></asp:label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:textbox runat="server" Width="175px" ID="TboxFax" style="text-transform:uppercase"></asp:textbox>
    </td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:Label runat="server" Text="Mobile 1 :" ID="LblMobile1"></asp:Label></td>
    <td> <asp:textbox runat="server" Width="175px" ID="TboxMobile1" style="text-transform:uppercase"></asp:textbox>
    <asp:label runat="server" text="Mobile 2 :" ID="LblMobile2"></asp:label>
    <asp:textbox runat="server" Width="175px" ID="TboxMobile2" style="text-transform:uppercase"></asp:textbox>
    </td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Agent Code :" ID="LblAgentCode"></asp:label></td>
    <td> <asp:textbox runat="server" Width="175px" ID="TboxAgentCode" style="text-transform:uppercase"></asp:textbox>
    <asp:textbox runat="server" Width="250px" ID="TboxAgentCode1" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="Brok. Rate % :" ID="LblBrokRate"></asp:label>
    &nbsp;<asp:textbox runat="server" Width="50px" ID="TboxBrokRate" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Int.Rate/p.a : Dr" ID="LblIntRateDr"></asp:label></td>
    <td> <asp:textbox runat="server" Width="175px" ID="TboxIntRateDr" style="text-transform:uppercase"></asp:textbox>

    &nbsp;<asp:label runat="server" text="Int.Cr :" ID="LblIntRateCr"></asp:label>&nbsp;&nbsp;
    <asp:textbox runat="server" Width="50px" ID="TboxIntRateCr" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="Grace Days :" ID="LblGraceDays"></asp:label>
    &nbsp;<asp:textbox runat="server" Width="50px" ID="TboxGraceDays" style="text-transform:uppercase"></asp:textbox>

    &nbsp;<asp:label runat="server" text="Year Days :" ID="LblYearDays"></asp:label>
    &nbsp;&nbsp;
    <asp:textbox runat="server" Width="50px" ID="TboxYearDays" style="text-transform:uppercase"></asp:textbox>
    &nbsp;<asp:label runat="server" text="Credit Limit :"
    ID="LblCreditLimit"></asp:label>
    &nbsp;<asp:textbox runat="server" Width="79px" ID="TboxCreditLimit" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Transport Name :" ID="LblTransportName"></asp:label></td>
    <td><asp:textbox runat="server" Width="400px" ID="TboxTransportName" style="text-transform:uppercase" onkeydown="return Event(event)"
    OnTextChanged="TboxTransportName_TextChanged" AutoPostBack="true"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Party Group Name :" ID="LblPartyGroupName"></asp:label></td>
    <td> <asp:textbox runat="server" Width="400px" ID="TboxPartyGroupName" style="text-transform:uppercase" onkeydown="return Event1(event)"
    OnTextChanged="TboxPartyGroupName_TextChanged" AutoPostBack="true"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Category :" ID="LblCategory"></asp:label></td>
    <td><asp:textbox runat="server" Width="400px" ID="TboxCategory" style="text-transform:uppercase"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"> <asp:label runat="server" text="Godown Name :" ID="LblGodownName"></asp:label></td>
    <td> <asp:textbox runat="server" Width="400px" ID="TboxGodownName" style="text-transform:uppercase" onkeydown="return Event2(event)"
    OnTextChanged="TboxGodownName_TextChanged" AutoPostBack="true"></asp:textbox></td>
    </tr>
    <tr>
    <td class="auto-style1"><asp:label runat="server" text="C/O Name :" ID="LblCoName"></asp:label></td>
    <td><asp:textbox runat="server" Width="300px" ID="TboxCoName" style="text-transform:uppercase"></asp:textbox>
    <asp:textbox runat="server" Width="175px" ID="TboxCoName1" style="text-transform:uppercase"></asp:textbox></td>
    </tr>

    </table>
    </Content>

    </asp:AccordionPane>
    <asp:AccordionPane ID="AccordionPane2" runat="server">
    <Header>More Account Detail</Header>
    <Content>
    <table>
    <tr>
    <td><asp:Label ID="LblLSTTIN" runat="server" Text="LST TIN :"></asp:Label></td>
    <td><asp:TextBox ID="TBoxLSTTIN1" runat="server" Width="200px"></asp:TextBox>
    <asp:TextBox ID="TBoxLSTTIN2" runat="server"></asp:TextBox>
    <asp:Label ID="LblCSTTIN" runat="server" Text="CST TIN :"></asp:Label>
    <asp:TextBox ID="TBoxCSTTIN1" runat="server" Width="200px"></asp:TextBox>
    <asp:TextBox ID="TBoxCSTTIN2" runat="server"></asp:TextBox>
    </td>
    </tr>

    <tr>
    <td><asp:Label ID="LblPanNo" runat="server" Text="PAN No. :"></asp:Label></td>
    <td><asp:TextBox ID="TBoxPanNo" runat="server" Width="200px"></asp:TextBox>
    <asp:Label ID="LblTDSNo" runat="server" Text="TDS No. :"></asp:Label>
    <asp:TextBox ID="TBoxTDSNo" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td><asp:Label ID="LblServiceTaxNo" runat="server" Text="Service Tax No. :"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxServiceTaxNo" runat="server" Width="200px"></asp:TextBox>
    <asp:Label ID="LblDepreciationRate" runat="server" Text="Depreciation Rate :"></asp:Label>
    <asp:TextBox ID="TBoxDepriciationRate" runat="server" Width="100px"></asp:TextBox>
    <asp:Label ID="LblTaxType" runat="server" Text="Tax Type :"></asp:Label>
    <asp:TextBox ID="TBoxTaxType" runat="server" Width="200px"></asp:TextBox>
    </td>
    </tr>

    <tr>
    <td><asp:Label ID="LblWebSiteURL" runat="server" Text="WebSite URL"></asp:Label></td>
    <td><asp:TextBox ID="TBoxWebSiteURL" runat="server" Width="400px"></asp:TextBox></td>
    </tr>


    <tr>
    <td><asp:Label ID="LblEmailID" runat="server" Text="Email ID"></asp:Label></td>
    <td><asp:TextBox ID="TBoxEmailID" runat="server" Width="400px"></asp:TextBox></td>
    </tr>


    <tr>
    <td><asp:Label ID="LblAddress" runat="server" Text="Address"></asp:Label></td>
    <td><asp:TextBox ID="TBoxAddress" runat="server" Width="400px"></asp:TextBox></td>
    </tr>

    <tr>
    <td></td>
    <td><asp:TextBox ID="TBoxAddress2" runat="server" Width="400px"></asp:TextBox></td>
    </tr>
    <tr>
    <td></td>
    <td><asp:TextBox ID="TBoxAddress3" runat="server" Width="400px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblStation1" runat="server" Text="Station"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxStation1" runat="server" Width="200px"></asp:TextBox>
    <asp:Label ID="LblPinCode1" runat="server" Text="Pin Code"></asp:Label>
    <asp:TextBox ID="TBoxPinCode1" runat="server" Width="200px"></asp:TextBox>
    </td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblPhone3" runat="server" Text="Phone 1"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxPhone3" runat="server" Width="200px"></asp:TextBox>
    <asp:Label ID="LblPhone4" runat="server" Text="Phone 2"></asp:Label>
    <asp:TextBox ID="TboxPhone4" runat="server" Width="200px"></asp:TextBox>
    </td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblTDSAccount" runat="server" Text="TDS ACCOUNT"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxTDSAccount1" runat="server" Width="150px"></asp:TextBox>
    <asp:TextBox ID="TBoxTDSAccount2" runat="server" Width="300px"></asp:TextBox>
    </td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblTDSApp" runat="server" Text="TDS App.? :"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxTDSApp" runat="server" Width="75px"></asp:TextBox>
    <asp:Label ID="LblTDSRate" runat="server" Text="TDS Rate"></asp:Label>
    <asp:TextBox ID="TBoxTDSRate" runat="server" Width="75px"></asp:TextBox>
    <asp:Label ID="LblSurcharge" runat="server" Text="Surcharge"></asp:Label>
    <asp:TextBox ID="TBoxSurcharge" runat="server" Width="75px"></asp:TextBox>
    <asp:Label ID="LblECess" runat="server" Text="E.Cess"></asp:Label>
    <asp:TextBox ID="TBoxECess" runat="server" Width="75px"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="LblExciseRegNo" runat="server" Text="Excise Reg. No."></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxExciseRegNo" runat="server" Width="300px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblECCNo" runat="server" Text="ECC No."></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxECCNo" runat="server" Width="300px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblRange" runat="server" Text="Range"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxRange" runat="server" Width="300px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblDivision" runat="server" Text="Division"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxDivision" runat="server" Width="300px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblCommissioerate" runat="server" Text="Commissioerate"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxCommissioerate" runat="server" Width="300px"></asp:TextBox></td>
    </tr>

    <tr>
    <td>
    <asp:Label ID="LblRemark" runat="server" Text="Remark"></asp:Label></td>
    <td>
    <asp:TextBox ID="TBoxRemark" runat="server" TextMode="MultiLine" Width="800px" Height="50px"></asp:TextBox></td>
    </tr>
    </table>
    </Content>
    </asp:AccordionPane>
    </Panes>
    </asp:Accordion>


    <div id="footer">
    <table>
    <tr>
    <td><br /><br />
    <asp:button runat="server" text="First" ID="BtnFirst" Width="65px" Font-Size="Smaller" />
    <asp:button runat="server" text="Previous" ID="BtnPrevious" Width="65px" Font-Size="Smaller" />
    <asp:button runat="server" text="Next" ID="BtlNext" Width="65px" Font-Size="Smaller" />
    <asp:button runat="server" text="Last" ID="BtnLast" Width="65px" Font-Size="Smaller" />
    <asp:button runat="server" text="Search" ID="BtnSearch" Width="65px" Font-Size="Smaller" OnClick="BtnSearch_Click" />
    <asp:button runat="server" text="Add" ID="BtnAdd" Width="65px" Font-Size="Smaller" OnClick="BtnAdd_Click" />
    <asp:button runat="server" text="Edit" ID="BtnEdit" Width="65px" Font-Size="Smaller" OnClick="BtnEdit_Click" />
    <asp:button runat="server" text="Save" ID="BtnSave" Width="65px" Font-Size="Smaller" OnClick="BtnSave_Click" />
    <asp:button runat="server" text="Cancel" ID="BtnCancel" Width="65px" Font-Size="Smaller" OnClick="BtnCancel_Click" />
    <asp:button runat="server" text="Delete" ID="BtnDelete" Width="65px" Font-Size="Smaller" />
    <asp:button runat="server" text="Exit" ID="BtnExit" Width="65px" Font-Size="Smaller" OnClick="BtnExit_Click" />
    </td>
    </tr>
    </table>
    </div>

    <asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="CommonHelpPUP" runat="server" TargetControlID="lnkFake" PopupControlID="Panel1" BackgroundCssClass="ModalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup">
    <div class="header"> Account Master Help </div>
    <div style="width: 100%; height: 200px; overflow: auto">

    <asp:GridView ID="GRDCommonHelp" runat="server" AutoGenerateColumns="false" OnDataBound="GRDCommonHelp_OnDataBound" DataKeyNames="CASH_ACC">
    <Columns>
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:LinkButton ID="select" runat="server" OnClick="DisplayGridValue">Select</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="CASH_ACC" HeaderText="CODE" />
    <asp:BoundField DataField="ACC_TITLE" HeaderText="Name" />
    <asp:BoundField DataField="CITY_ACC" HeaderText="City Name" />
    <asp:BoundField DataField="LEVL_CODE" HeaderText="Account Group" />
    </Columns>
    </asp:GridView>
    </div>
    </asp:Panel>

    <asp:LinkButton ID="dumy" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="dumy" PopupControlID="PanelConfirm" BackgroundCssClass="ModalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="PanelConfirm" runat="server" style="display:none" CssClass="modalPopup">
    <div class="header">Account Group Master</div>
    <div style="width: 100%; height: 200px; overflow: auto">
    <asp:GridView ID="GRDGroupHelp" runat="server" AutoGenerateColumns="false" Width="576px" OnDataBound="GRDGroupHelp_OnDataBound" DataKeyNames="LEVL_CODE">
    <Columns>
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:LinkButton ID="select" runat="server" OnClick="DisplayGridValue4Group">Select</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="LEVL_CODE" HeaderText="Group Name" />
    <asp:BoundField DataField="LEVL_YN" HeaderText="Group Primary" />
    <asp:BoundField DataField="MAIN_LEVL" HeaderText="Group Head" />
    </Columns>
    </asp:GridView>
    </div>
    </asp:Panel>

    <asp:LinkButton ID="dummy" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="ModalTransportPUP" runat="server" TargetControlID="dummy" PopupControlID="Panel2" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel2" runat="server" CssClass="modalPopup">
    <div class="header">Transport Master</div>
    <div style="width: 100%; height: 200px; overflow: auto">
    <asp:GridView ID="GRDTransportHelp" runat="server" AutoGenerateColumns="false" OnDataBound="GRDTransportHelp_OnDataBound" DataKeyNames="CASH_ACC">
    <Columns>
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:LinkButton ID="select" runat="server" OnClick="DisplayGridValue4Transport">Select</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="CASH_ACC" HeaderText="Transport Name" />

    </Columns>
    </asp:GridView>
    </div>
    </asp:Panel>

    <asp:LinkButton ID="temp" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="ModalPartyGroupPUP" runat="server" TargetControlID="temp" PopupControlID="Panel3" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel3" runat="server" CssClass="modalPopup">
    <div class="header">Party Group Master</div>
    <div style="width: 100%; height: 200px; overflow: auto">
    <asp:GridView ID="GRDPartyGroup" runat="server" AutoGenerateColumns="false" OnDataBound="GRDPartyGroup_OnDataBound" DataKeyNames="CASH_ACC">
    <Columns>
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:LinkButton ID="select" runat="server" OnClick="DisplayGridValue4PartyGroup">Select</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="CASH_ACC" HeaderText="Party Group" />
    </Columns>
    </asp:GridView>
    </div>
    </asp:Panel>

    <asp:LinkButton ID="temp1" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="ModalGodownPUP" runat="server" TargetControlID="temp1" PopupControlID="Panel4" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel4" runat="server" CssClass="modalPopup">
    <div class="header">Godown Master</div>
    <div style="width:auto; height:200px; overflow:auto ">
    <asp:GridView ID="GRDGodown" runat="server" AutoGenerateColumns="false" OnDataBound="GRDGodown_OnDataBound" DataKeyNames="CASH_ACC">
    <Columns>
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:LinkButton ID="select" runat="server" OnClick="DisplayGridValue4Godown">Select</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="CASH_ACC" HeaderText="GoDown" />
    </Columns>
    </asp:GridView>
    </div>

    </asp:Panel>


    <asp:LinkButton ID="temp2" runat="server"></asp:LinkButton>
    <asp:ConfirmButtonExtender ID="DeleteConfirmation" runat="server" TargetControlID="temp2" DisplayModalPopupID="DeleteModalPUP"></asp:ConfirmButtonExtender>
    <asp:ModalPopupExtender ID="DeleteModalPUP" runat="server" BackgroundCssClass="modalBackground" CancelControlID="btnNo" PopupControlID="Panel5" TargetControlID="temp2"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel5" runat="server" CssClass="modalPopup">
    <div class="header">Confirm</div>
    <table style="border:Solid 2px #D46900; width:auto; height:auto">
    <tr style="background-image:url(~/Styles/images/Header.gif)">
    <td style=" height:10%; color:White; font-weight:bold;padding:3px; font-size:larger; font-family:Calibri" align="Left" colspan="2">Confirm Box</td>
    </tr>
    <tr>
    <td colspan="2" style="padding:5px; font-family:Calibri">
    <asp:Label ID="lblUser" runat="server" Text="Are you sure you want to delete selected Record?"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    <tr>
    <td> </td>
    <td style="padding-right:15px">
    <asp:ImageButton ID="btnYes" OnClick="btnDelete_Click" runat="server" ImageUrl="~/Styles/images/btnYes.jpg" />
    <asp:ImageButton ID="btnNo" runat="server" ImageUrl="~/Styles/images/btnNo.jpg" />
    </td>
    </tr>
    </table>

    </asp:Panel>

    <asp:LinkButton ID="t1" runat="server"></asp:LinkButton>
    <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="t1" DisplayModalPopupID="TextDiplicationPUP"></asp:ConfirmButtonExtender>
    <asp:ModalPopupExtender ID="TextDiplicationPUP" runat="server" TargetControlID="t1" PopupControlID="Panel6" CancelControlID="BtnOK" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel6" runat="server" CssClass="modalPopup">
    <div class="header">MESSAGE BOX</div>
    <table style="border:Solid 2px #D46900; width:auto; height:auto">
    <tr>
    <td colspan="2" style="padding:5px; font-family:Calibri">
    <asp:Label ID="Label1" runat="server" Text="Record Exist !!!"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    <tr>
    <td> </td>
    <td style="padding-right:15px">
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:ImageButton ID="BtnOK" runat="server" ImageUrl="~/Styles/images/okbtn.png" Height="22px" Width="55px" OnClientClick="OnClick()" />
    </td>
    </tr>
    </table>
    </asp:Panel>


    <asp:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="t1" DisplayModalPopupID="RecordSamePUP"></asp:ConfirmButtonExtender>
    <asp:ModalPopupExtender ID="RecordSamePUP" runat="server" TargetControlID="t1" PopupControlID="Panel7" CancelControlID="BtnOK1" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="Panel7" runat="server" CssClass="modalPopup">
    <div class="header">MESSAGE BOX</div>
    <table style="border:Solid 2px #D46900; width:auto; height:auto">
    <tr>
    <td colspan="2" style="padding:5px; font-family:Calibri">
    <asp:Label ID="Label2" runat="server" Text="Record does not exist.Please Select Proper Record!!!"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    <tr>
    <td> </td>
    <td style="padding-right:15px">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:ImageButton ID="BtnOK1" runat="server" ImageUrl="~/Styles/images/okbtn.png" Height="24px" Width="55px"/>
    </td>
    </tr>
    </table>
    </asp:Panel>

    </form>
    </body>
    </html>

    Wednesday, April 2, 2014 7:12 AM
  • User1140095199 posted

    Hi,

    I have a textbox inside accordion panel in which I display message on textbox change event using modalpopup extender and while click on the button inside modalpopup I have apply javascript to clear textbox but it's not working my javascript code is

    Change the JS function:

     <script type="text/javascript">
         function OnClick() {
             if ($("BtnOK").click()) {
                 document.getElementById("<%=TBoxAccountCode.ClientID%>").value ="";
                 
                 document.getElementById("<%=TBoxAccountCode.ClientID%>").focus();
             }
         }

    I reproduced and checked it. It's working now. Problem was that at runtime the control id's are rendered differently. So for server controls always use ClientID property to get the control ID.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 3, 2014 3:37 AM