0
我有一個GridViewRow []具有一些數據,這些數據是針對從先前的頁面中選擇實施例4點的行(圖1)恢復值和傳遞到GridViewRow
複選框後標記,用戶必須發送到確認頁面,在這個頁面中,我需要生成另一個gridviewRow,只有4 selected.i'm使用會話將值傳遞到另一個頁面,但我不能讓它工作,我在foreach中做錯了。這是代碼。
ASCX
<asp:GridView runat="server" class="Tabelas" Width="698px" ID="grdSimulacao" AutoGenerateColumns="False">
<HeaderStyle CssClass="TabelasHeader branca-10NN"></HeaderStyle>
<RowStyle CssClass="TabelasBody grid"></RowStyle>
<AlternatingRowStyle CssClass="TabelasBodyAlt grid" BackColor="#EEEEEE"></AlternatingRowStyle>
<Columns>
<asp:BoundField HeaderText="NF" DataField="NUMNOTAFISCAL">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Emissão" DataField="DTEMISSAO" DataFormatString="{0:dd/MM/yyyy}">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Vencimento" DataField="DTVENCIMENTO" DataFormatString="{0:dd/MM/yyyy}">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Dias" DataField="DIASANTEC">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Valor(R$)" DataField="VALTOTAL" DataFormatString="{0:#,0.00}">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Encargos(R$)" DataField="VLENCARGOS" DataFormatString="{0:#,0.00}">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="Vlr. Final(R$)" DataField="VLFINAL" DataFormatString="{0:#,0.00}">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
</asp:GridView>
CS - 註釋的部分是事情,我alrady試過,但沒有sucess。
public void Carrega_valores()
{
string NUMNOTAFISCAL = "";
string PRAZOPGTO = "";
GridViewRow[] valoresNovos = new GridViewRow[300];
valoresNovos = (GridViewRow[])Session["vlColunas"];
foreach (GridViewRow grdCount in valoresNovos)
{
DataTable dt = new DataTable();
if (grdCount != null)
{
//NUMNOTAFISCAL = grdCount.Cells[1].Text;
//PRAZOPGTO = grdCount.Cells[4].Text;
}
//GridViewRow row = (GridViewRow)grdCount.Rows[0].Clone();
}
//DataRow NewRow = dt.NewRow();
//NewRow[1] = grdCount.Cells[1].Text;
//dt.Rows.Add(NewRow);
//grdSimulacao.DataSource = dt;
//grdSimulacao.DataBind();
// }
//grdSimulacao.Controls[0].Controls.Add(valoresNovos[0]);
// grdSimulacao.DataSource = valoresNovos;
// grdSimulacao.DataBind();
// }
}