我有这个gridview,我试图打印出用户检查的任何列的MMBR_PROM_ID。
(默认.apsx)
Welcome to ASP.NET!
</h2>
<div style="width: 700px; height: 370px; overflow: auto; float: left;">
<asp:GridView ID="GridView1" runat="server" HeaderStyle-CssClass="headerValue"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="Generate">
<ItemTemplate>
<asp:CheckBox ID="grdViewCheck" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Generate" />
</asp:Content>
(默认.aspx.cs)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FrontOffEntities tmpdb = new FrontOffEntities();
List<MMBR_PROM> newListMMBR_Prom = tmpdb.MMBR_PROM.ToList();
GridView1.DataSource = newListMMBR_Prom;
GridView1.DataBind();
}
}
所以我的目标是当我按下生成时,我希望能够将用户检查的所有 MMBR_PROM_ID 作为字符串打印出来。我对 aspnet 有点陌生,所以我很难应付语法