DATAGRID導出時要加上EXCEL標識符.不然導出EXCEL會有問題.

Protected Sub DataGridList_ItemDataBound(ByVal sender As System.Object, ByVal e As DataGridItemEventArgs)

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

e.Item.Cells(0).Attributes.Add("style", "vnd.ms-excel.numberformat:@")

End If

End Sub

你可能感兴趣的:(datagrid)