1

I have a toolbar that when an item is clicked that it calls a radconfirm window from an external js file, and when you click on the ok button it calls a callbackfunction, in the callbackfunction I am searching for Button1 to call its onclick event so I can add some code to delete a record from the database. I know this can be done when all the script is put into the markup, but I want to clean up the markup an put everything in an external js file.

The javascript is..

function CallConfirm() {
var oConfirm = radconfirm("howdy", confirmCallbackFn, 500, 500);
}

function confirmCallbackFn(arg) {
if (arg == true) //the user clicked OK
    {
        document.getElementById("<%=Button1.ClientID%>").click();
    }
else {
    document.getElementById("rbtnRefesh").click();
    }
}

Any idea's would be appreciated, other than "use ajax and a webmethod". I don't have any webmethods and I am not using the WebAPI either, just using a stored procedure.

Thanks

7
  • What server-side technology are you using? Commented May 15, 2015 at 23:34
  • @Jasen, sorry, I am using ASP.NET and C# Commented May 15, 2015 at 23:36
  • 2
    Probably your biggest obstacle will be getting those control Ids into the external javascript file. Commented May 15, 2015 at 23:49
  • @Jasen, That worked exactly like I wanted it to. If you want to post that somehow as an answer I would be more than happy to accept. It saved me a lot of grief. Commented May 15, 2015 at 23:54
  • If helpful, you should vote that question up instead of creating duplicate ones. Glad to help. Commented May 15, 2015 at 23:57

1 Answer 1

1

Declare a global Javascript variable that contain the button ID name on the aspx page. After that, you can then reference this variable on the external JS files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.