asp.net 导出GridView里的数据到Excel中,全部,当前页,选择行,选中行,所选行,复
关键字: asp.net 导出 gridview 数据 excel 全部 当前页 选择行 选中行 所选行 复选框
按下保存按钮,可以选择保存当前行,当前页和全部记录
C#代码
#region 保存
/// <summary>
/// 保存
/// </summary>
protected void btnBC_Click(object sender, EventArgs e)
{
string save_cblJL = "";
for (int i = 0; i < this.cblJL.Items.Count; i++)
{
if (this.cblJL.Items[i].Selected == true)
{
save_cblJL += this.cblJL.Items[i].Value + ",";
}
}
string[] save_Excel = save_cblJL.Split(',');
for (int j = 0; j < save_Excel.Length - 1;j++ )
{
if (save_Excel[j].Equals("全部记录"))
{
toExcelClk(gvwjdccx, 3);
}
else if (save_Excel[j].Equals("当前页"))
{
toExcelClk(gvwjdccx, 2);
}
else if (save_Excel[j].Equals("当前记录"))
{
toExcelClk(gvwjdccx, 1);
}
}
}
#endregion 保存
#region 保存
/// <summary>
/// 保存
/// </summary>
protected void btnBC_Click(object sender, EventArgs e)
{
string save_cblJL = "";
for (int i = 0; i < this.cblJL.Items.Count; i++)
{
if (this.cblJL.Items[i].Selected == true)
{
save_cblJL += this.cblJL.Items[i].Value + ",";
}
}
string[] save_Excel = save_cblJL.Split(',');
for (int j = 0; j < save_Excel.Length - 1;j++ )