protected void GridView1_DataBound(object sender, EventArgs e)
{
int rowCnt = GridView1.VisibleRowCount //这个属性
int pageSize = GridView1.SettingsPager.PageSize
if (rowCnt != 0 &&rowCnt != pageSize)
{
DataTable dt = (DataTable)GridView1.DataSource
if (table != null)
{
for (int i = 0i <pageSize - rowCnti++)
{
int rowIndex = rowCnt + i + 1
DataRow row = dt.NewRow() //这个方法
for (int j = 0j <GridView1.Columns.Countj++)
{
row[j] = ""
}
dt.Rows.Add(row) //增加一行
}
}
}
GridView.DataSource=dt
GridView.DataBind()
}
可以在gridview的item点击事件中将点击的图片路径传值过去gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?>arg0, View view, int position,
long arg3) {
Intent intent=new Intent(MainActivity.this,ss.class)
Bundle bundler=new Bundle()
bundler.putString("pic","path")
intent.putExtras(bundler)
startActivity(intent)
}
})
自己在代码视图里手动改。eg:
<asp:GridView ID="GridMx" runat="server" AutoGenerateColumns="false" BorderColor="black" OnRowDataBound="GridMx_RowDataBound" OnRowCreated="GridMx_RowCreated" DataKeyNames="nid">
<Columns>
<asp:TemplateField ItemStyle-Width="25">
<ItemTemplate>
<asp:CheckBox ID="choose" runat="server" Text="" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="120">
<ItemTemplate>
<asp:TextBox ID="CustomNo" runat="server" text='<%# Eval("customno") %>' Width="120"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="wpcrkdh" />
<asp:BoundField DataField="bdmc" ItemStyle-Font-Size="11px" ItemStyle-Width="80" />
<asp:BoundField DataField="rkrq" DataFormatString="{0:yyyy/MM/dd}" HtmlEncode="false" ItemStyle-Width="80" ItemStyle-HorizontalAlign="right" />
<asp:BoundField DataField="ckmc" ItemStyle-Width="60" />
<asp:BoundField DataField="wpmc" ItemStyle-Width="80" />
<asp:BoundField DataField="ggxh" ItemStyle-Width="120" />
<asp:BoundField DataField="sl" ItemStyle-Width="80" ItemStyle-HorizontalAlign="right" DataFormatString="{0:F2}" HtmlEncode="false" ItemStyle-Font-Size="10px" />
<asp:BoundField DataField="je" ItemStyle-Width="80" ItemStyle-HorizontalAlign="right" DataFormatString="{0:F2}" HtmlEncode="false" ItemStyle-Font-Size="10px" />
<asp:BoundField DataField="sqm" ItemStyle-Width="80" ItemStyle-HorizontalAlign="right" DataFormatString="{0:F2}" HtmlEncode="false" ItemStyle-Font-Size="10px" />
<asp:BoundField DataField="kg" ItemStyle-Width="80" ItemStyle-HorizontalAlign="right" DataFormatString="{0:F2}" HtmlEncode="false" ItemStyle-Font-Size="10px" />
<asp:BoundField DataField="pch" ItemStyle-Font-Size="10px" ItemStyle-Width="100" />
<asp:BoundField DataField="ordno" ItemStyle-Width="82" />
<asp:BoundField DataField="supplyname" ItemStyle-Width="80" />
<asp:BoundField DataField="invoicetypename" ItemStyle-Width="100" />
</Columns>
</asp:GridView>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)