|
POST
|
It is my assumption that this solution forces the user to click the button and then click in the map. That if the user chooses to select a different feature they would have to click the button again and then select a feature in the map? Or am I wrong? The workflow I need is: The map is inactive for selecting Click a "Start" button to activate map clicks (multiple map clicks) The user can click as many times as they choose After clicking a separate "submit" button (disable the ability to click the map until the "start" button is clicked)
... View more
05-11-2020
05:55 AM
|
0
|
4
|
5981
|
|
POST
|
I have a map that I want the user to interface with. Right now the below code works great but the map is ALWAYS active. I need to be able to activate the clicks after a button is clicked. Until the user clicks a button the viewright.on("click"...... is not enabled. On page reload the button should have to be clicked again to register the clicks in the map Any thoughts? viewright.on("click", function (evt) {
viewright.hitTest(evt.screenPoint).then(function (response) {
// Do a bunch of stuff
});
});
... View more
05-08-2020
01:07 PM
|
0
|
11
|
6919
|
|
POST
|
Than Aung I cannot thank you enough for all your thoughts and support....I had a difficult case here as I was restrained by the developer that created this website and think that through your thoughts and steering I was able to come up with a solution....OF course this could not have happened without your guidance.....I cannot thank you enough....peace. I think I may have found a solution that works for me.... My main issue was that I could not rely on the page load complete event to reference my javascript code because of the way the web site was designed. But the dojo/ready was always an option if I could control when I called it.... After some testing I think this is the solution....right now I am simply calling this on the page load complete. which as stated before was an issue.... I should be able to control when this is called....whether it be on a text box focus, combo box change etc...etc I NOW have absolute control when I load the JS page using the dojo/ready function to start my code. protected void Page_Load(object sender, EventArgs e)
{
Page.LoadComplete += new EventHandler(Page_LoadComplete);
}
void Page_LoadComplete(object sender, EventArgs e)
{
string myScript2 = "\n<script type=\"text/javascript\" language=\"Javascript\" src=\"js/index.js\">\n";
myScript2 += "\n\n </script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", myScript2, false);
} I should now be able to do this like I was trying to do !!!!!! Still relaying on when the script loads protected void gvNew_SelectedIndexChanged(object sender, EventArgs e)
{
string myScript2 = "\n<script type=\"text/javascript\" language=\"Javascript\" src=\"js/index.js\">\n";
myScript2 += "\n\n </script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", myScript2, false);
}
... View more
05-08-2020
07:38 AM
|
1
|
1
|
41787
|
|
POST
|
Hi Than Aung first off thank you for your continued support with this...thinking that I am getting close to an end and will be defeated....while understanding the issues related to server and client side programming.... I totally agree with the url you posted. BUT again this is when the JS is in the HTML page. That is NOT my case I am referring to the situation when the JS is an external page. I do not see anywhere n the URL link you provided where they call and external JS page....all the JS is in the aspx page Successful but cannot be used: 1. As stated I can use the ScriptManager and convert all my JS code to an escaped string and run it through there... 2. As stated I can call the external JS code from a Button in xxxx.aspx page 3. As stated I can call the external JS page via page load complete and the dojo ready function in the JS page But this cannot be used in my case because the way the designer made the aspx page 4. As you stated I can call JS code BUT that code has to be in <script> tags in the xxxx.aspx page Although I am trying to call a JS function in a seperate JS page from the xxxx.aspx.cs page. I am assuming that this cannot be done as no solution has presented itself. Trying to call the JS function from within the xxxx.aspx.cs page ... NO GO in the xxx.aspx page <script type="text/javascript" lang="javascript" src="js/index.js"> in the xxx.aspx.cs page protected void gvTrappers_SelectedIndexChanged(object sender, EventArgs e)
{
// CALL EXTERNAL JS FUNCTION that is in js/index.js
myFunction();
} I tried this at the end of the xxxx.aspx page Trying to load my js page and then call a function in it....NO GO <script type="text/javascript" lang="javascript" src="js/index.js">
myFunction();
</script>
... View more
05-08-2020
06:32 AM
|
0
|
0
|
7711
|
|
POST
|
Not exactly.... I can get the session variable and place it in a hidden control no issues I can retrieve the controls value no issues but thats not my problem My issue is that I need to call a function in an external JS page from C#, not a page load trigger, not a button trigger, not a dom ready trigger. After the selectedindexchanged event fires I need to call a JS function in an external JS page and pass that value to a JS function that resides in an external JS page Below is the only way I know how to run JS code from within C# BUT I need a way to call a JS function that is NOT in the .cs page ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript2", "alert('TestString');", true); Can I use the below to call a function in the JS Page itself? ScriptManager.RegisterStartupScript(this, GetType(), "index", "javascript: myFunction();", true);
... View more
05-06-2020
05:17 AM
|
0
|
0
|
7711
|
|
POST
|
Than Aung I saw this...Not sure how to call a function that is in the JS file itself though.... Using JavaScript Along with ASP.NET 2.0 | Microsoft Docs Keeping JavaScript in a Separate File (.js) Keeping JavaScript functions in a separate file (a .js file) is highly recommended. Once they are in a separate file and part of a project, the file can be imported into a page using some of the methods already described. For instance, a .js file can be included in an ASP.NET page using the following code: Visual Basic Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "MyScript", _ "MyJavaScriptFile.js") C# Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "MyJavaScriptFile.js"); Once the .js file is imported into the ASP.NET page, any of the JavaScript functions can be called as before. This is a great way to manage JavaScript functions and keep them separate from the other logic of ASP.NET pages. It is also an easy way to use the same JavaScript functions on multiple ASP.NET pages.
... View more
05-05-2020
12:46 PM
|
0
|
2
|
34078
|
|
POST
|
Than Aung I want to do this....not sure if I can I can get the Alert and the value from "script" below (In the TrEdit.aspx.cs FILE seen below) I would like to take that and pass it to an external Javascript function defined in the aspx page Maybe this is whats causing my error below? Maybe I cannot do this entirely? <script lang="javascript" src = "js/index.js" type="text/javascript"></script> ERROR: VM187:1 Uncaught ReferenceError: myFunctionCSharp is not defined at <anonymous>:1:13 Site.Master -- Notice context to MainContent referencing the second ASPX page below The JS page is defined here on the Site.Master file.... <!-- SNIP -->
<link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/light/main.css"/>
<script src="https://js.arcgis.com/4.14/"></script>
<script lang="javascript" src = "js/index.js" type="text/javascript"></script>
<!-- SNIP -->
</head>
<body class="home">
<!-- SNIP -->
<main>
<br />
<br />
<article>
<form id="form1" runat="server">
<div id="content">
<h1>List</h1>
<h2 id="tagline"><i><%: Page.Title %></i></h2>
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
</div>
</form>
</article>
</main>
<!-- SNIP -->
</body>
</html> TrEdit.aspx file - Notice the reference to the .aspx.cs page below <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="TrEdit.aspx.cs" Inherits="NW.Edit" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
TrEdit.aspx.cs FILE I am trying to call the JavaScript function from here BECAUSE I cannot do it on the page load complete as I am not being sent to another page...I want to fire the JS code from this function I AM RUNNING the below code in the protected void from xxxx.aspx which is referenced in the Site.Master file... ID="MainContent" protected void gvTrappers_SelectedIndexChanged(object sender, EventArgs e)
{
int i;
if (row != null)
{
i = row.RowIndex; ;
}
else
{
btnExpandCritters_Click(sender, e); // pass it on....
}
// =====================================
string IDGUID = Session["NWTL_ID_String"].ToString();
string IDGUIDstring = IDGUID;
string nIDGUID11 = "alert(\"" + IDGUIDstring + "\")";
string script = nIDGUID11;
ScriptManager.RegisterStartupScript(this, GetType(),"ServerControlScript", script, true);
ScriptManager.RegisterStartupScript(this, GetType(), "Javascript", "javascript: myFunctionCSharp(IDGUID);", true);
} In the EXTERNAL JS PAGE require([
"esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer"
], function (Map, MapView, FeatureLayer
) {
"use strict";
function myFunctionCSharp(input) {
var inputValue = input;
alert(inputValue);
}
... View more
05-05-2020
10:36 AM
|
0
|
3
|
34077
|
|
POST
|
Again this application is not mine and the developer is only using one page and hiding and making visible stuff....frustrating because this makes the page load not function the way I was expecting....Although it is doing what I want -- the way the app is built does not allow me to use the page load complete call.... no go for me.... I think all of this will work fine once I find a new trigger to run this code. Back to the drawing board .... will be in touch soon....I think your help is sufficient but want to check a few things before we close this one and give you the credit...
... View more
05-05-2020
09:24 AM
|
0
|
4
|
34077
|
|
POST
|
Thanks for the info....trying to read through it....confusing but trying... At the top of the Site.Master I have the JS reference At the bottom of the Site.Master I have the following code... I get the alert saying "alert here" so I received conformation the page was loaded. I then try and call a JS function that exists in the location of the reference (external JS File) <script lang="javascript" src = "js/index.js" type="text/javascript"></script> I do NOT get that alert...so I am not getting there... ALTHOUGH I get the Alert from the domReady in the JS page -- alert("In the JS file"); ALTHOUGH I can get the Alert for the ready function and CALL the myFunction() and get its alert BUT this is simply being done on Load of the Pages.... I need to call a functions separate from a Page Load success.....is it even possible to call a JS function directly from C# aspx .net???? What am I missing here.....going back to read your post to try and figure this out. Maybe I am totally confused here....Client and Server is hard to work with....uggggg <!-- TOP OF THE SITE.MASTER -->
<link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/light/main.css"/>
<script src="https://js.arcgis.com/4.14/"></script>
<script lang="javascript" src = "js/index.js" type="text/javascript"></script>
<!-- BOTTOM OF THE SITE.MASTER -->
<script>
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete" || document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
docReady(function () {
// DOM is loaded and ready for manipulation here
alert("alert here");
// NOW CALL MY JS FUNCTION IN THE index.js external file
myFunction();
});
</script>
</body>
</html> EXTERNAL JS FILE Referenced above. require([
"esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer",
"dojo/ready", "dojo/domReady!"
], function (Map, MapView, FeatureLayer,
ready
) {
"use strict";
function myFunction(){
alert("In myFunction in the JS Page via C# Call");
}
alert("In the JS file");
ready(function () {
alert("In the function called by the Ready Function");
myFunctionFromReady();
});
function myFunctionFromReady(){
alert("In myFunction in the JS Page via JS Ready function Call");
}
... View more
05-05-2020
06:16 AM
|
0
|
5
|
34077
|
|
POST
|
Trying this to call the JS Page void Page_LoadComplete(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:Testreturn(); ", true);
}
... View more
05-04-2020
07:06 AM
|
0
|
7
|
34077
|
|
POST
|
Thanks and that helps.....SO I am grabbing a session variable from the Page_LoadComplete and now need to pass this to an external js page. Its in the solution but not in the aspx etc. js indexed from the Site.Master aspx page <script lang="javascript" src = "js/index.js" type="text/javascript"></script> void Page_LoadComplete(object sender, EventArgs e)
{
// call your download function
//Check if the Session value exists
if (Session["ID"] != null)
{
string IDGUID = Session["ID"].ToString();
TextBoxIDGUID.Text = IDGUID;
}
// Call a function in the index.js page referenced in the main aspx page
// I do want this to fire after page load NOT from a button
// ????????
}
... View more
05-04-2020
06:57 AM
|
0
|
0
|
34077
|
|
POST
|
Note: this is a stand alone JS page in the .net solution.....I need to call a function in the stand alone JS page after page load.
... View more
05-01-2020
07:41 PM
|
0
|
0
|
34077
|
|
POST
|
I have an aspx C# .net app that was written apart from me I added a map component outside the FORM tags. I am trying to find a trigger that AFTER the page loads where I can fire off a JavaScript Function....I am stuck and have tried a hundred different Google searches... Is there an after Page Load that I can reference from the aspx page? OR How can I call a Separate JS file Function that resides in the Solution from C# .net after some sort of trigger from the .net page PLEASE HELP
... View more
05-01-2020
07:13 PM
|
0
|
15
|
42856
|
|
POST
|
I have no idea what happened...I deleted everything including FC and tables and rebuilt everything moving forward....it works now....sometimes don't ask why...
... View more
04-23-2020
03:36 PM
|
0
|
0
|
1316
|
|
POST
|
This seems to work...I write to the FC and then to the table BUT for some reason this python script works when ran from ArcCatalog BUT does not work after published to a GP Service. If I remove the relationship class it works great....add the relationship class back and it fails from JavaScript ugggggggg Do I have to write to the FC and add a unique ID and then write to the related table and add that same unique ID (thats what I am doing below) or Can I write to the FC and have it automatically add a record in the related table with some unique ID Just sort of confused by the whole process and on top of that the GP Service works in Catalog although does NOT when I publish it with the Relationship Class.... I delete the Relationship Class and it works fine????/ Puzzled here with arcpy.da.InsertCursor(input_Featureclass, ['SHAPE@', 'ADDRESSgeocode', 'DISTANCEparameter', 'UNIQUEIDparameter', 'COUNTYLIST', 'NWTLID']) as cursor:
edit.startOperation()
# Perform edits
cursor.insertRow([geometries[0], validGuid])
with arcpy.da.InsertCursor(input_Table, ['ID', 'FieldID']) as cursor2:
cursor2.insertRow([validGuid, 1520])
del cursor2
## Delete cursor object
del cursor
# SNIP
... View more
04-22-2020
02:13 PM
|
0
|
0
|
1150
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|