链接按钮单击事件未触发 [英] Link button Click event not firing

查看:90
本文介绍了链接按钮单击事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//面板显示为弹出窗口

//Panel to be shown as Popup

<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


//Ajax Modal popupEctender

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




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



//链接按钮代码(.cs页面)


//Link Button Code(.cs Page)

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


Popup is comming but link button's click event is not firing
Plz help me..thanks

推荐答案

\" />
</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>
" /> </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


//Ajax Modal popupEctender

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




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



//Link Button Code(.cs Page)


//Link Button Code(.cs Page)

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


Popup is comming but link button's click event is not firing
Plz help me..thanks


Did you try this?

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



Let me know if worked.


Let me know if worked.


make sure the link handles the event. click the button to make sure. ;)

make sure the link handles the event. click the button to make sure. ;)
protected void lnkAddNewQues_Click(object sender, EventArgs e) handles lnkAddNewQues.Click


这篇关于链接按钮单击事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆