替换标签后用到分页,我把标签替换成
<form id='form1' runat='server'>
<asp:GridView ID='GridView1' runat='server' AllowPaging='True' AutoGenerateColumns='False'DataSourceID='sds_make'PageSize='20'>
<Columns>
<asp:HyperLinkField DataNavigateUrlFields='id' DataNavigateUrlFormatString='view.aspx?id={0}'DataTextField='title' HeaderText='标题'>
<ItemStyle Font-Size='Small' />
<HeaderStyle Font-Size='Small' />
</asp:HyperLinkField>
<asp:BoundField DataField='updatetime' HeaderText='更新时间'>
<ItemStyle Font-Size='Small' />
<HeaderStyle Font-Size='Small' />
</asp:BoundField>
</Columns>
</asp:GridView>
</form>
替换完了后,在页面中不显示gridview1,只能在页面源代码中看到上述代码,这个gridview1就没有执行.
是不是我的这种替换方式不行啊?能不能像asp中那样写分页代码?

解决方案 »

  1.   

    我把模板中的标签替换成上面的代码,但上面的代码不执行啊,不显示gridview1
      

  2.   

    想要把HTML代码直接显示在网页上是不行的。应该通过转换其中的关键符号成为HTML可以识别的符号
      

  3.   

    我认为按照datagrid的分页时间更简单
    <asp:datagrid id="dgrid" runat="server" AllowPaging="True" CellPadding="3" BackColor="Transparent" BorderWidth="1px" BorderStyle="Solid" AutoGenerateColumns="False" Width="100%" Height="20px" HeaderStyle-BackColor="#ff0066" AllowSorting="True">
    <AlternatingItemStyle ForeColor="ControlText" BackColor="White"></AlternatingItemStyle>
    <ItemStyle HorizontalAlign="Center" ForeColor="ControlText" BackColor="WhiteSmoke"></ItemStyle>
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="Black" VerticalAlign="Middle"
    BackColor="Control"></HeaderStyle>
    <Columns>
    <asp:BoundColumn Visible="False" DataField="ID" HeaderText="ID"></asp:BoundColumn>
    <asp:BoundColumn DataField="单号" HeaderText="单号"></asp:BoundColumn>
    <asp:BoundColumn DataField="产品批号" HeaderText="批次编号"></asp:BoundColumn>
    <asp:BoundColumn DataField="产品编号" HeaderText="产品编号"></asp:BoundColumn>
    <asp:BoundColumn DataField="送出数量" HeaderText="送出数量"></asp:BoundColumn>
    <asp:BoundColumn DataField="收回数量" HeaderText="收回数量"></asp:BoundColumn>
    <asp:BoundColumn DataField="返工数量" HeaderText="返工数量"></asp:BoundColumn>
    <asp:BoundColumn DataField="结余量" HeaderText="结余量"></asp:BoundColumn>
    <asp:BoundColumn DataField="时间" HeaderText="时间"></asp:BoundColumn>
    </Columns>
    <PagerStyle NextPageText="下一页" PrevPageText="上一页"></PagerStyle>
    </asp:datagrid>