Click here to Skip to main content
15,889,354 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
//Panel to be shown as Popup
XML
<asp:Panel ID="pnlPopupQuestionAdd" runat="server">
                <div align="center" style="background-color: White; margin: 5px; padding: 5px;">
                    <table>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Label ID="lblHeader" runat="server" Text="Add Checklist Question" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblPopFileType" runat="server" Text="Type:" />
                                <asp:Label ID="lblMandatoryFldType" runat="server" Text="*" ForeColor="Red" />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlPopupType" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblpopSchoolName" runat="server" Text="School Name:" />
                                <asp:Label ID="lblMandatoryFldName" runat="server" Text="*" ForeColor="Red" />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlPopSchoolName" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblPageNo" runat="server" Text="Page Number:" />
                            </td>
                            <td>
                                <asp:TextBox ID="txtPageNo" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblQuesNo" runat="server" Text="Question Number:" />
                                <asp:Label ID="lblMandatoryFldQuesNo" runat="server" Text="*" ForeColor="Red" />
                            </td>
                            <td>
                                <asp:TextBox ID="txtQuesNo" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:RequiredFieldValidator ID="reqFldValQuesNo" runat="server" SetFocusOnError="true"
                                    ErrorMessage="Enter Question Number" ControlToValidate="txtQuesNo" />
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="regExpValQuesNo" runat="server" ErrorMessage="Enter Numeric Only"
                                    SetFocusOnError="true" ControlToValidate="txtQuesNo" ValidationExpression="^\d+$" />
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblQues" runat="server" Text="Checklist Question:" />
                                <asp:Label ID="lblMandatoryFldQues" runat="server" Text="*" ForeColor="Red" />
                            </td>
                            <td>
                                <asp:TextBox ID="txtQues" runat="server" TextMode="MultiLine" />
                            </td>
                        </tr>
                        <td></td>
                        <td>
                        <asp:RequiredFieldValidator ID="reqFldValAddQuesText" runat="server" ErrorMessage="Enter Question" SetFocusOnError="true" ControlToValidate="txtQues" />
                        </td>
                        <tr>
                            <td align="center" colspan="2">
                                <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Label ID="lblNotes" runat="server" Text="Note: Question Number will overwrite Page Number in case of any discrepancies." />
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>

//Ajax Modal popupEctender
VB
<ajaxToolkit:ModalPopupExtender ID="popAddQues" runat="server" TargetControlID="lnkAddNewQues"
          PopupControlID="pnlPopupQuestionAdd" CancelControlID="btnCancel" Enabled="true"
          BackgroundCssClass="modalBackground" DropShadow="false" />

XML
//link Button(on click Popup should come)
<asp:LinkButton ID="lnkAddNewQues" runat="server" Text="Add" OnClick="lnkAddNewQues_Click" />

//Link Button Code(.cs Page)
C#
protected void lnkAddNewQues_Click(object sender, EventArgs e)
       {
           fillType(ddlEditQuesType);
           fillSchool(ddlQuesEditSchoolName);
           ddlEditQuesType.SelectedItem.Text = ddlType.SelectedItem.Text;
           ddlQuesEditSchoolName.SelectedItem.Text = ddlSchoolName.SelectedItem.Text;
           //txtQuesEditPageNo,txtQuesEditQuesNo,txtChklistQuesEditQues
           string Ques = ddlChecklistQuestions.SelectedItem.Text;
           int length = Ques.Length;
           txtQuesEditPageNo.Text = Ques.Substring(0, 1);
           txtQuesEditQuesNo.Text = Ques.Substring(2, 1);
           txtChklistQuesEditQues.Text = Ques.Substring(4, length - 4);
       }

Popup is comming but link button's click event is not firing
Plz help me..thanks
Posted
Updated 11-Jul-12 22:29pm
v2
Comments
AshishChaudha 12-Jul-12 5:01am    
Have you checked it with debugger???

Did you try this?
ASP.NET
<asp:linkbutton id="lnkAddNewQues" runat="server" text="Add" onclick="lnkAddNewQues_Click" causesvalidation="false" />

Let me know if worked.
 
Share this answer
 
v2
Comments
kevinman117 10-Jul-14 3:53am    
Thank you so much! I've been finding this "bug" like forever... You're the man!
Bluestorm@123456 23-Aug-18 8:01am    
Thank u it worked for me.
make sure the link handles the event. click the button to make sure. ;)
C#
protected void lnkAddNewQues_Click(object sender, EventArgs e) handles lnkAddNewQues.Click
 
Share this answer
 
v2
Comments
graciax8 12-Jul-12 5:45am    
why did you downvoted my answer?

you have this OnClick="lnkAddNewQues_Click" but in your code you are missing handles lnkAddNewQues.Click

double click your link button in the design page to make sure it is pointing you to the right event in the code-behind.

Goodluck!
Christian Amado 27-Mar-14 20:44pm    
Downvoted because handles only works in VB.NET not in C#.
That looks like a mix of c# and VB, it is not going to work
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900