ashok kumar

ashok kumar

  • NA
  • 89
  • 36.1k

How to acess the iframe from an static webmethod

Aug 21 2013 6:11 AM
Hi,
    I have written an jquery code to call my webmethod, webmethod is invoking no issue in that, in that webmethod iam not able to add the iframe elements attributes.Iam getting object refrence not set to an instance at run time.pls help me out. in adding the iframe attributes.

aspx code:
  <iframe   id="IframeZoneBased"   runat="server" frameborder="0"   vspace="0"   hspace="0"   marginwidth="0"   marginheight="0"   scrolling="auto"   src="../MasterPage/ListPage.aspx" name="I1" style="width: 400px; height: 210px"/>

cs:
 [WebMethod]
        public static void loadavailablecabs(string PickupLat, string PickUpLon)
        {
            BookingPage p = new BookingPage();
            p.IframeZoneBased.Attributes.Add("src", "../MasterPage/MiniListPage.aspx?CompanyID=" + "2" + "&LocationId=" + " 1" + "&EmployeeId=" + "2" + "&RoleId=" + "3" + "&LoginID=" + "3");//not working
           p.loadtest();
           // 
        }
        public void loadtest()
        {
           
            IframeCabavailable.Attributes.Add("src", "../MasterPage/MiniListPage.aspx?CompanyID=" + strCompanyid + "&LocationId=" + strGelocationid + "&EmployeeId=" + "0" + "&RoleId=" + strRoleid + "&LoginID=" + strLoginid);//not working
     

Answers (2)