单击padeing时,不显示值值 [英] value dose not show when we click on padeing

查看:56
本文介绍了单击padeing时,不显示值值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按钮单击值显示在网格视图中,但我一次只能分页显示10个值,但是当我单击下一步时,数据不会在asp.net的网格视图中显示
我使用这些代码

on button click value show in gride view but i allow pageing only 10 value show at a time but when i click on next the data do not show in gride view in asp.net
i use these code

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
   {
       try
       {
           GridView1.PageIndex = e.NewPageIndex;
           GridView1.DataSource = ds;
           GridView1.DataBind();
       }
       catch (Exception ex)
       {
           Response.Write(ex.Message);
       }

   }







<asp:GridView ID="GridView1" runat="server"  

  AutoGenerateColumns="False"  Height="50px" 

            CellPadding="4" ForeColor="Black" GridLines="None" Width="588px"  

                    ShowHeader="False"  Font-Bold="False" Font-Size="Small" Font-Strikeout="False" 

            onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True" 

                    onpageindexchanged="GridView1_PageIndexChanged" 

                    onpageindexchanging="GridView1_PageIndexChanging">
                    <rowstyle backcolor="#EFF3FB" />
            <columns>
         
                <asp:TemplateField>
                
                    <itemtemplate>
                    <table>
                     <tr>
                        <td rowspan="4">
                            <asp:Image ID="Image1" runat="server"  

                                Width="75px" ImageUrl="images/Image/image0.png" /> </td>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></td>
                        <td rowspan="4">Address:-
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("Address") %>'></td>
                    </tr>
                    <tr>
                        <td>Contact:-
                             <asp:Label ID="Label3" runat="server" Text='<%# Bind("Contact") %>'></td>
                    </tr>
                    <tr>
                        <td>Class:-
                             <asp:Label ID="Label4" runat="server" Text='<%# Bind("ClassName") %>'></td>
                    </tr>
                    <tr>
                        <td>City:-
                             <asp:Label ID="Label5" runat="server" Text='<%# Bind("City") %>'></td>
                    </tr>
                       
                       </table>
                    </itemtemplate>
                
               
            </columns>
            <footerstyle backcolor="#507CD1" font-bold="True" forecolor="White" />
            <pagerstyle backcolor="#2461BF" forecolor="White">
                HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <editrowstyle backcolor="#2461BF" />
            <alternatingrowstyle backcolor="White" />




分页"网格视图不起作用.它显示了前5行,但是没有显示asp.net中的分页数,但是代码无法以正确的方式运行




Paging" gride view does not work. It shows the first 5 rows, but does not show the number of paging in asp.net but the code is not working in a proper way

推荐答案

不要写
GridView1.DataSource = ds;


在pageindex中更改仅写


in pageindex changing only write

GridView1.PageIndex = e.NewPageIndex;
                     GridView1.DataBind();



在您的代码中....



in your code....


这篇关于单击padeing时,不显示值值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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