Click here to Skip to main content
11,492,523 members (61,066 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL
I have a popup modal using and it does appear but when i click btnOkay instead of navigating to
it do nothing

Here is my code
        <asp:scriptmanager id="ScriptManager1" runat="server">

<cc1:modalpopupextender id="ModalPopupExtender1"  runat="server" 
	cancelcontrolid="btnCancel" okcontrolid="btnOkay" 
	targetcontrolid="btnVote" popupcontrolid="Panel1" 
	popupdraghandlecontrolid="PopupHeader" drag="true" 
        <asp:Panel ID="Panel1" Style="display: none;" runat="server">
            <div class="HellowWorldPopup">
                <div class="PopupHeader" id="PopupHeader">
                    <h3>Read before you vote!</h3>
                <div class="PopupBody">
                    <p>Are you sure you wanna procede</p>
                <div class="Controls">
                    <asp:Button ID="btnOkay" OnClick="btnOkay_Click" runat="server" Text="Agree" />
                    <asp:Button ID="btnCancel" runat="server" Text="Decline" />

Here is my

 protected void btnOkay_Click(object sender, EventArgs e)
        string sql = "SELECT * FROM STUDENT WHERE Student_Number = '" + Session["name"].ToString() + "'";
        SqlConnection conn = new SqlConnection(ConnString);
        SqlCommand cmd = new SqlCommand(sql, conn);
        if (conn.State == ConnectionState.Closed)
        DataTable dt = new DataTable();
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        if (dt.Rows[0]["Student_Nationality"].ToString() == "South African" && dt.Rows[0]["Student_Accomodation"].ToString() == "On Campus")
        else if (dt.Rows[0]["Student_Nationality"].ToString() == "South African" && dt.Rows[0]["Student_Accomodation"].ToString() == "Off Campus")
        else if (dt.Rows[0]["Student_Nationality"].ToString() == "Non South Afircan" && dt.Rows[0]["Student_Accomodation"].ToString() == "On Campus")
        else if (dt.Rows[0]["Student_Nationality"].ToString() == "Non South Afircan" && dt.Rows[0]["Student_Accomodation"].ToString() == "Off Campus")
            Response.Write("Sorry You can not vote");
Posted 10-Jul-13 0:22am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It seems that the click event of OK or CANCEL button's of modalpopupextender does not get fired.

Try removing the :


from modalpopupextender and check if it works.
210032278 at 10-Jul-13 7:13am
Thanx, its wekin perfectly.... :-) -RSA
Priyanka7777 at 10-Jul-13 7:30am
Im glad that it helped you!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 399
1 Maciej Los 266
2 KarstenK 210
3 CPallini 208
4 Sascha Lefèvre 195
0 Sergey Alexandrovich Kryukov 9,943
1 OriginalGriff 8,610
2 Sascha Lefèvre 3,609
3 Maciej Los 3,372
4 Richard Deeming 2,440

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100