Hi agarwalvidhu;
thanks for your reply again.
My problem is: I have a windows application, not a web project in C#, and this application has a windows form with a datagrid.
I create a button to save the datagrid context to a excell format.
To do this i use your example code.
The System.Web namespace was imported correctly and i use the instance of HttpContext, like below, to acess all of the Response propertys and methods.
public static void ConvertXLS(DataSet ds)
{
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
//first let's clean up the response.object
response.Clear();
response.Buffer = true;
response.Charset = "";
But in a runtime the line "System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;" provokes an exception like below:
"System.NullReferenceException: Object reference not set to an instance of an object."
Can you help me again???
thanks...
|