首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

为什么在使用的自定义的pagertemplate的翻页时会触发对页面上控件的有效性验证,先谢了

2012-02-03 
为什么在使用的自定义的pagertemplate的翻页时会触发对页面上控件的有效性验证,急,在线等,先谢了代码如下:

为什么在使用的自定义的pagertemplate的翻页时会触发对页面上控件的有效性验证,急,在线等,先谢了
代码如下:

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

<!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> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:TextBox   ID= "TextBox1 "   runat= "server "> </asp:TextBox>
                <asp:RequiredFieldValidator   ID= "RequiredFieldValidator1 "   runat= "server "   ControlToValidate= "TextBox1 "
                        ErrorMessage= "RequiredFieldValidator "> </asp:RequiredFieldValidator>
                <asp:Button   ID= "Button1 "   runat= "server "   Text= "Button "   /> <br   />
                <asp:GridView   ID= "GridView1 "   runat= "server "   AllowPaging= "True "   AutoGenerateColumns= "False "   DataSourceID= "SqlDataSource1 ">
                        <Columns>
                                <asp:BoundField   DataField= "UserID "   HeaderText= "UserID "   InsertVisible= "False "   ReadOnly= "True "
                                        SortExpression= "UserID "   />
                                <asp:BoundField   DataField= "UserName "   HeaderText= "UserName "   SortExpression= "UserName "   />
                                <asp:BoundField   DataField= "Sex "   HeaderText= "Sex "   SortExpression= "Sex "   />
                                <asp:BoundField   DataField= "Phone "   HeaderText= "Phone "   SortExpression= "Phone "   />
                                <asp:BoundField   DataField= "Email "   HeaderText= "Email "   SortExpression= "Email "   />
                                <asp:CommandField   ShowDeleteButton= "True "   ShowEditButton= "True "   />


                        </Columns>
                        <pagertemplate>
                      <table   width= "100% ">
                            <tr>
                                <td>
                                    <asp:LinkButton   id= "PreviousButton "
                                        text= " < "
                                        CommandName= "Page "
                                        CommandArgument= "Prev "
                                        runat= "Server "/>
                                    <asp:LinkButton   id= "NextButton "
                                        text= "> "
                                        CommandName= "Page "
                                        CommandArgument= "Next "
                                        runat= "Server "/>  
                                </td>

                            </tr>
                        </table>                    
                    </pagertemplate>
                </asp:GridView>
                <asp:SqlDataSource   ID= "SqlDataSource1 "   runat= "server "   ConnectionString= " <%$   ConnectionStrings:SqlConnectionString   %> "   SelectCommand= "SELECT   [UserID],   [UserName],   [Sex],   [Phone],   [Email],   FROM   [Users] "> </asp:SqlDataSource>     </div>
        </form>
</body>
</html>

页面中若将
    <pagertemplate>
                      <table   width= "100% ">


                            <tr>
                                <td>
                                    <asp:LinkButton   id= "PreviousButton "
                                        text= " < "
                                        CommandName= "Page "
                                        CommandArgument= "Prev "
                                        runat= "Server "/>
                                    <asp:LinkButton   id= "NextButton "
                                        text= "> "
                                        CommandName= "Page "
                                        CommandArgument= "Next "
                                        runat= "Server "/>  
                                </td>

                            </tr>
                        </table>                    
                    </pagertemplate>
去掉,就不会触发有效性验证.我现在需要使用自定义pagertemplate,不知应该如何解决.


[解决办法]
up
[解决办法]
设置控件的CausesValidation= "False "就不会触发了
[解决办法]
up!
[解决办法]
请设置

<asp:LinkButton CausesValidation= "false " ...

热点排行