
นั่งงมอยู่ตั้งนาน ก็เลยเจอวิธีแก้ว่าให้เพิ่มโค้ดดังนี้ครับ
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As System.Web.UI.Control)
'MyBase.VerifyRenderingInServerForm(control)
End Sub
แค่นี้ก็ใช้งานได้แล้วครับ
แต่ถ้าใครเจอปัญหาว่า "RegisterForEventValidation can only be called during Render();"

ให้เอา AllowSorting กับ AllowPaging ออกครับ
เท่านี้เราก็สามารถใช้ GridView ในการสร้าง Excel ได้แล้วครับ
๓ ความคิดเห็น:
ขอบคุณมากครับ พอดีเจอปัญหานี้เหมือนกัน
เจอปัญหาที่ว่า export หลายๆฟิลด์ กลับ error network อ่ะค่ะ ERR_CONNECTION_RESET หมายความว่าอย่างไรค่ะ แต่เป็นบาง ฟิลด์ กลับได้ปกติ
แสดงความคิดเห็น