hi all
i am trying to call server side method on client side because on linkbutton click page is refreshing
To avoid page refresh i am calling server side method on client side
but i am getting error as "Httpexception has caught Response is not available in this context."
my code is
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnableScriptGlobalization="true">
</asp:ScriptManager>
<asp:LinkButton ID="ibtncommonzoom" runat="server" class="mdi-action-find-in-page" Width="25%" Height="25%" OnClientClick="ibtncommonzoom_Click()" ></asp:LinkButton>
<script type="text/javascript">
function ibtncommonzoom_Click()
{
var queryID = document.getElementById('<%=Label1.ClientID %>').innerText;
var name = ddlcommon.options[ddlcommon.selectedIndex].value;
var area = null;
var no = null;
if (name != "0") {
PageMethods.mes(queryID, name, area, no);
}
return false;
}
</script>
aspx.cs
static developing instance = null;
public developing()
{
instance = this;
}
public static void mes(string queryID, string name, string indusarea, string plotno)
{
instance.zoomlayers(queryID, name, indusarea, plotno);
}
[ScriptMethod, WebMethod]
public void layers(string queryID, string name, string area, string no)
{
try
{
ds = objServiceClientobjService.names(queryID, name, indusarea, plotno);
.
.
.
.
.
////////////////////////////////////
String locateScript = String.Format("<script language='javascript'>Test('{0}','{1}','{2}','{3}')</script>", valx1, valy1, valx2, valy2);------------not going to this function
Locate(locateScript);
}
protected string Locate(string locateScript)
{
Response.Write(locateScript);
return (locateScript);
}
i have wrote public static void mes(----------------) and calling public void layers(--------------------) because when i mention public static void layers(--------------)
then inside the method dataset(wcf) and controls are getting error as "An object reference is required for non static field, method----"
thatwhy i have wrote public static void mes(----------------)
every thing is working fine , it is goning to wcf and getting the values but it is not going to external js pageTest(x1,y1,x2,y2) function
and getting error as "Httpexception has caught Response is not available in this context.'