how to add a reference to the master page script manager, from the user control?
-
I have a ScriptManager which is added to my MasterPage; <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true" /> I have a Web User Control which is placed on the master page. Inside the web user control, I'd like to use PageMethods but it complains that PageMethods is not defined. function ddlSqlConnections_SelectedIndexChange(selectedValue) { PageMethods.OnSelectedIndexChanged(selectedValue); location.reload(true); } I added a new ScriptManager to the user control and it complained that only one scriptmanager can exist on one page so basically how to add a reference to the master page script manager, from the user control? It doesn't seem to be possible? Thanks,
-
Answer:
Use a regular ScriptManager instead of the RadScriptManager: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
The Light at Stack Overflow Visit the source
Other answers
My conclusion was it's not possible with a Web User Control Page Method and I used AJAX with web service instead: $('.ddlSqlConnections').change(function (control) { var selectedValue = control.currentTarget.value; if (selectedValue == 0) { return; } $.ajax({ type: "POST", url: "AdminService.asmx/AdminConnectionsOnSelectedIndexChanged", data: "{uniqueName: " + selectedValue + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { location.reload(true); }, error: function (msg) { alert('failed to send a web service request; please contact the administrator.') } }); });
William
You could try to Invoke a method in your masterpage from your userconrol. Page.GetType().InvokeMember("MethodName", BindingFlags.InvokeMethod, null, this.Page, new object[] { });
Jimmy Mattsson
Related Q & A:
- How to add a contact to a specific list?Best solution by Stack Overflow
- How to add a block in checkout page in Magento?Best solution by stackoverflow.com
- How to add a picture to my groups page?Best solution by Yahoo! Answers
- How do you add a layout to the yahoo page?Best solution by Yahoo! Answers
- How to add a picture to a Wikipedia page?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.