0

Hi, having some problem...Plz help me out from this

I have problem in ModalPopupExtender. When I click on submit button of pop up it does not call the code behind code written for button click.. Here is my code-

<ajaxtoolkit:modalpopupextender id="ModalPopupExtender" runat="server"
cancelcontrolid="LinkButton1" dropshadow="false" okcontrolid="btnSubmit" X="200" Y="100" popupcontrolid="Panel1" targetcontrolid="imgSchedul">
<aspanel id=Panel1 runat="server" style="display:none;">
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
onclick="SubmitData" ValidationGroup="MainValidation"/>
</aspanel>

protected void SubmitData(object sender, EventArgs e)
{
//code for submit data.
}

I have written onclick event for btnSubmit in code behind file. Now my problem is, this event is not firing when I click Submit Button on Panel.

1
Contributor
1
Reply
3
Views
7 Years
Discussion Span
Last Post by gauravkukreja06
0

hi got it...

The following code works , wherein I am calling button click of a server side button through client side code .

Check out this code :-

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

<!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>Untitled Page</title>
    <script type="text/javascript" language="javascript">
    function pageLoad()
    {
        $addHandler($get('btn1') , 'click' , onClick);
    }

    function onClick() // this onclick event is for cleint side input button
    {
        $get('btn').click(); // here i am calling the server side click event of asp:button with id 'btn'
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" ID="Script1"></asp:ScriptManager>
    <div>
    <asp:TextBox runat="server" ID="txtTrial"></asp:TextBox>
    <input type="button" id="btn1" runat="server" value="Client Button" />
    <asp:Button runat="server" ID="btn" Text="Server button" OnClick="btn_Click" />
    </div>
    </form>
</body>
</html>


protected void btn_Click(object sender, EventArgs e) // server side click event of asp button
    {
///ur code
}

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.