有谁知道如何将值从动态创建的gridview复选框传递到水晶报表?是否可能?我使用的是asp.net,vb.net和mssql。这是我的网格减去几个边界域:
<asp:gridview id="grid" runat="server" autogeneratecolumns="False" cellpadding="4"
forecolor="#333333" gridlines="None" emptydatatext="No Products registered for this company...">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" onclick="javascript:HighlightRow(this);" AutoPostBack="True"/>
</ItemTemplate>
<HeaderTemplate>
<input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
</HeaderTemplate>
</asp:TemplateField>
<asp:BoundField DataField="aid#" HeaderText="AID#" />
<asp:BoundField DataField="brandname" HeaderText="Brand Name" />
<asp:BoundField DataField="exp_date" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Exp. Date" />
</Columns>
</asp:gridview>
答案 0 :(得分:0)
这是在C#中,但概念是相同的。你需要遍历每一行,找到复选框,检查它是否“已检查”并获取Datakeys值。
// processCount is just used to calculate the total rows Checked.
int processCount = 0;
for (int indx = 0; indx < GridView1.Rows.Count; indx++)
{
Control control = GridView1.Rows[indx].FindControl("Id");
if (control != null && control is CheckBox)
{
var chkbx = (CheckBox)control;
if (chkbx.Checked)
{
string rowId = GridView1.DataKeys[indx].Value.ToString();
//Do something with your DataKey value.....
processCount++;
}
}
}