AJAX, Calling a web service inside Master page from its child page

Dear Team

 

I am using ASP.NET2.0, C#, AJAX.

 

I am having a Master page that I add inside it a script manager:

<form id="form1" runat="server" defaultbutton="btnMaster">

    <asp:ScriptManager ID="ScriptManager1" runat="server">        <Services>            <asp:ServiceReference Path="QuoteDeleteRow.asmx"/>        </Services>   

</asp:ScriptManager>

    <div>

 

 

 And this is the code for the web service it self: using System.Web.Services;using System;using System.Data;using System.Text;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Microsoft.Practices.EnterpriseLibrary.Data;using Microsoft.Practices.EnterpriseLibrary.Data.Sql;using System.Data.SqlClient;using System.Data.Common;using BusinessLayer;using Microsoft.Web.Script.Services;using System.Web.Services.Protocols;using System.Web.Services;using System.Xml;using Configurator; /// <summary>/// Summary description for Entry/// </summary>[WebService(Namespace = http://tempuri.org/)][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][ScriptService]public class QuoteDeleteRow : System.Web.Services.WebService{    public QuoteDeleteRow()    {         //Uncomment the following line if using designed components         //InitializeComponent();     }    [WebMethod]    public string IsRowSerialNumber(string strRowID) 

   {

        try        {            SerialNumber objSerialNumber = new SerialNumber();            int nCount = objSerialNumber.CheckQuoteDetailHasSerialNumber(new Guid(strRowID));             if (nCount > 0)            {                return "1";//Means Exsists.            }            else            {                return "0";//Means this No is Free.            }        }        catch (Exception ex)        {            throw new Exception("WebService Method IsRowSerialNumber, " + ex.Message);        } 

   }

    [WebMethod]    public void DeleteRow(string strRowID)    {        try        {            QuoteDetail objQuoteDetail = new QuoteDetail();            objQuoteDetail.DeleteQuoteDetail(new Guid(strRowID));        }        catch (Exception ex)        {            throw new Exception("WebService Method DeleteRow, " + ex.Message);        }    } }   

I have created a new Aspx page that is inherited from this master page and I want to call this web service this is the code I wrote:

 

function DeleteRow(rowIndex, rowID)

{ 

   QuoteDeleteRow.IsRowSerialNumber(rowID, ReturnValue);

}function ReturnValue(result){    var strResult = result; 

   if (strResult > 0)

    {        var answer = confirm("Service Part has serial numbers are you sure you want to delete it?")        if (answer)//yes is pressed       

 {

            QuoteDeleteRow.DeleteRow(rowID, ReturnValue2);        }
    }    else 

   {

//will delete without asking

        QuoteDeleteRow.DeleteRow(rowID, ReturnValue2);        }}function ReturnValue2(result){ 

   document.getElementById('<%=input_RefreshParent.ClientID%>').value = "Refresh";

    document.getElementById('<%=Button1.ClientID%>').click();} I have this error:JavaScript error – QuoteDeleteRow is undefiend Please advise me what to do. 

Thank you,

 

0
RamzyEbeid
1/29/2008 2:49:41 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

2 Replies
858 Views

Similar Articles

[PageSpeed] 8

pleae i need your help......

0
RamzyEbeid
1/29/2008 4:26:46 PM

RamzyEbeid,

you could try to add a scritmanagerproxy to you content page and add a reference from the scriptmanager proxy to your webservice. I think it isn't wise to add a reference to you webservice in a scriptmanager control which resides on your masterpage. This means that every content page which is based on your masterpage is having a reference to the webserivce.

PS: your code example is very hard to read

Regards,


Dennis van de Laar
http://dennisv.net/

Don't forget to mark the most helpful reply/replies as Answer.
0
Dennis
1/29/2008 7:50:50 PM
Reply:

Similar Artilces:

Calling Child Master Page from Super Master Page Programatically
I have pages in my application like default.aspx, aboutus.aspxThese pages have supermaster page file...Now again I have two master pages inside Skin1 and Skin2 Folder...I want in the runtime I shoudl be be able to switch between skin1.master and skin2.master For this I want to call skin1 or skin2 master from supermaster file.. programatically  Can anyone help me...I have used Page_PreInit, in supermaster Page, but it dint helped me.... Please MARK post as ANSWERED, if you find answer helpfulhttp://www.linkedin.com/in/shantanushukla I have done this by putting the Page_PreIni...

Master page ... Child page ... Add a child page specific stylesheet?
Hi All, I currently have a master page with the stylesheet links defined in the header. However, there are a few child pages that I want to have additional styles. For example, an article page that requires the adverts to be hidden. So, for children to this master page ... is it possible for me to modify the Master page’s Stylesheet collection.  Either by adding / removing stylesheets accordingly for some child pages?Thanking you in advance for your time.Scotty You can do this if the head element is server based:<head id="pageHead" runat="server">Then in your code, on any pa...

Calling fuction in child page from Master page
Hi, Is there a way that I can call a function located in child page (placed in ContentPlaceHolder) from the Master Page. forget about using a  public class because there are some function that I can't move them to a  public class.   Thanksbadis  hi!in master page define an event fired when user click some button or sth:public partial class MasterPage : System.Web.UI.MasterPage{    public event EventHandler OnTestClick;    protected void Button1_Click(object sender, EventArgs e)    {      &...

Timer on master page causes the child page to go through its page life cycle. (Expected but creates unnecessary calls)
I have a timer on my parent master page that checks for certain events and updates controls that I want through an updatePanel. I have numerous child pages that inherit from the master page. I get the desired effect of the timer checking for some event and updating the controls I specified.   The undesired effect is the timer will go through the selected(In View) child page --- page life cycle. So if I have a code in  my Page_Init or Page_Load event handlers whatever is in them gets executed. Doesn't render the html because it is a call back and only updates the con...

difference of calling web services and calling web page
Dear all,  What is the difference of call a web services instead of calling a aspx page which is also programming can accept parameters and return results? Webservice -- Soap protocol Webapplication  -- HTTP protocol Webservices are of two Major types Xml & SOAP HttpWebServices Basic difference is in usage and implementation. We use a webservice inside a website. it is added as a reference or we can call it through HttpWebRequests and Response objects. Webpages are the components that have presentation and logic, while web services provide the service that we...

Calling parent window (using master page) button click event from an opened child window (not using master page)
I have a parent window that pops up a child window. In the child window, there is a server control LinkButton, with the following command at code-behind upon clicking:         Response.Write("<SCRIPT> javascript:window.opener.document.getElementById('<%=btnMas.ClientID%>').click(); </SCRIPT>");        Response.Write("<SCRIPT> javascript:window.close() </SCRIPT>");        Response.End(); What it would like to do are:1) Invoke the ...

AJAX Master Page vs Master Page
 Using VS 08 with asp.net 3.5... What is the difference between these items...Add A New Item (to solution):AJAX Master Page vs Master PageAJAX Web Form ve Web Form Is it just that the AJAX version puts in the scriptmanger?  Or are there other differences?  Thanks Bob  Ajax masterPage just create a masterPage with ScriptManager , Ajax webFrom create a webform that contains ScriptManager and create a Javascsript Page Load method which i called when page loaded.  Regards,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you ...

parent web page --child web page
Dear Developers , how to get values child web page values to parent web page ? For the example , I have parent Employee Address. and child Page have employee personal address.. when i access the Parent page , there is no employee address means ..child page pop rises , after complete child page then only , i can access the parent page.. how to i do .. Thanking u raja Thanks,Regards,Rajamsrasa@yahoo.com...

Calling a Page_load event of Content Page inside master page?
How can I call a simple function defined in my content page from a master page?   Well if you're going to have the same method in multiple pages I would create an interface with the method defined and then implement that method in the pages.  That way in your masterpage you can test the Page property to see if it implements that interface and if so cast it to that type and call the method. Rob Millswww.dotnetadvisor.com Hi, You can try to refer this article: Passing Information Between Content and Master Pages Hope it helps.Amanda WangMicrosoft Online Community Supp...

In a web page(c#), I want to call another page and come back to next instruction of calling page
In a web page(c#), I want to call another page and come back to next instruction of calling page. Called page have no web item , it has only c# codes. after executing of this page (by IExplore), I want the remaining lines of calling page to be executed. How can I do that? What are you trying to do? What is the second page accomplishing? Will the first page stay open and the second page closes? You might be able to use WebRequest and WebResponse to do what you want. Hey bro, since you say that the called page has no web items, why dont you put the code in the called pa...

AJAX enabled page inside a SharePoint Page Viewer Web Part
I have a SharePoint 2007 site with a Page Viewer web part.  The page viewer web part points to an ASP.NET web application.  The application uses AJAX. When I go to the Application directly everything works fine.  When I go through the web part the AJAX stuff stops working.  Any ideas why? Thank you. Ron Hi, From your description, it seems that you are going to make an AJAX web page be run in a PageViewer WebPart, right? Actually,Page View Web Part is used to incorporate existing content (such as Web sites or documents) into a Web Part. This Web Part renders it...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Modifying a Parent Master Page from within a Child (Nested) Master Page's Page Lifecycle Event Handlers
Hello, I am having difficulty modifying a control within a parent master page from within a child master page. Essentially, I am building a custom tab-based navigation system, and depending on the page (or master page, in this case), I want to set the CssClass of a hyperlink in the master page to "selected". When I attempt this within the individual ASPX pages themselves, it works flawlessly, though, seems awfully redundant to rewrite the same code for a handful of pages that will inevitably share the same master page anyway. In stepping through (debugging), it seems that we n...

Web resources about - AJAX, Calling a web service inside Master page from its child page - asp.net.networking-webservices

Calling Dr. Death - Wikipedia, the free encyclopedia
Calling Dr. Death (1943) is the first of the Universal Pictures Inner Sanctum mystery films . The "Inner Sanctum" franchise originated with a ...

List of country calling codes - Wikipedia, the free encyclopedia
This is a list of country calling codes defined by ITU-T recommendations E.123 and E.164 , also called IDD ( International Direct Dialling ) ...

Calling Batman: Bane Takes Over Ecko Unlimited Facebook Page
Bane, the villain in upcoming Batman feature film The Dark Knight Rises , turned his criminal mind toward the Ecko Unlimited Facebook page , ...

Facebook Video Calling - Facebook
Bring your conversations to life on Facebook. With face-to-face video calling, now you can watch your friends smile, wink and LOL. To get started, ...

Facebook’s Talktime program in India pays new mobile users in calling credit
... Facebook has launched its Talktime program in India which gives every new user who signs up with a mobile device 50 Rupees (almost $1) in calling ...

Berlin Calling (@neuraum) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Calling all foodies: Here comes @TwitterFood
There are many thousands of food-related Tweets people send on Twitter each day – Tweets about meals, ingredients, favorites, recipes and dining ...

Rounds Video Calling + Chat for iPhone 4, iPhone 4S, iPhone 5, iPhone 5c, iPhone 5s, iPad 2 Wi-Fi, iPad ...
Get Rounds Video Calling + Chat on the App Store. See screenshots and ratings, and read customer reviews.


John Birmingham: Thank god for earthly angels when death comes calling
There are those among us, rare indeed, who hold our hands as we pass through pain, fear and confusion.

Resources last updated: 12/4/2015 10:26:00 AM