troubleshooting Question

Access a server side component from Java script in a webUserControl.ascx

Avatar of Clivous
Clivous asked on
Apple SoftwareWeb ComponentsWeb Applications
3 Comments1 Solution478 ViewsLast Modified:
Hi,

I have the following setup:

MasterPage.Master -> MyPage.aspx -> MyUserControl.ascx

In MyUserControl.ascx I have the following Jave script:

    function doCreatePoint() {
        GIS.Editor.EndEdit();
        GIS.Editor.CreateEmptyShape("gisShapeTypePoint");
    }  

My problem is dat this Jave script displays a error (can't find GIS) when I call it from the following button:

                        <table>                                
                           
                            <tr>
                               
                                <td class="ButtonCanvasHeight">
                                    <asp:ImageButton
                                        ID="ButtonPoint"
                                        runat="server"
                                        OnClientClick="doCreatePoint();"                            
                                        ImageUrl="~/Images/New.png"
                                        height="24px"
                                        width="24px" />
                                </td>

I also try the following Java script:

    function doCreatePoint() {
        var controlid = '<%= GIS.ClientID %>';
        var gis = document.getElementById(controlid);
        gis.Editor.EndEdit();
        gis.Editor.CreateEmptyShape("gisShapeTypePoint");
    }  

But then I get a error with the message 'the editor is empty'. I think that the GIS component is not loaded when i call this Java script. When I try the whole setup directly in a aspx page without a masterpage then it works.

How can I make this to work?
ASKER CERTIFIED SOLUTION
Rosenet

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros