I have a scenario... I made a class RequestAndResponse in asp.net In App_Code folder. I want to access this in Default.aspx page but i am getting a problem Here is the code:
public partial class _Default : Page
{
RequestAndResponse request = new RequestAndResponse();
protected void Button1_Click(object sender, EventArgs e)
{
try
{
if (!String.IsNullOrEmpty(txtbox_query.Text.Trim()))
{
request.getParameter(txtbox_query.Text.Trim(), sourcePath,parameterValue);
request.BeginInvokeService(InvokeCompleted);
Response.Write(returnFromService);
}
else
{
//to do
}
}
catch (Exception error)
{
Response.Write(error.StackTrace);
}
}
public static void InvokeCompleted(IAsyncResult result)
{
returnFromService = request.EndInvokeService(result);
}
Now the scenario i hv created a object 'request' and want to access in InvokeCompleted method but i want able to do it. How will i do this??
Error: An object reference is required for the non-static field,method or property 'Default.request'
Aucun commentaire:
Enregistrer un commentaire