//使用GridView 导出excel表格,导出excel对特殊的控件进行模式化处理
public static void PrepareGridViewForExport(Control gv)//模式化特殊元素的函数
{
HyperLink lb = new HyperLink();
LinkButton bt = new LinkButton();
Literal l = new Literal();
string name = String.Empty;
RadioButton rb = new RadioButton();
for (int i = 0; i < gv.Controls.Count; i++)
{
if (gv.Controls[i].GetType() == typeof(HyperLink))
{
l.Text = (gv.Controls[i] as HyperLink).Text;
gv.Controls.Remove(gv.Controls[i]);
gv.Controls.AddAt(i, l);
}
else if (gv.Controls[i].GetType() == typeof(DropDownList))
{
DropDownList dl = gv.Controls[i] as DropDownList;
for (int j= 0; j< this.dl.Items.Count; j++)
{
rb.Text = dl.Items[j].Text;
if (rb.Text == dl.SelectedItem.Text)
rb.Checked = true;
gv.Controls.AddAt(i, l);
}
gv.Controls.Remove(dl); //移除DropDownlist
}
else if (gv.Controls[i].GetType() == typeof(CheckBox))
{