The LinkButton feature is not functioning correctly in combination with the showmodaldialog

What is the best way to open a window.showModalDialog with a link button when updating a form?

I have a link button on my form that updates data. When the client's status becomes active, I want to open a window for additional information entry.

 Public Function OpenWindowRequest(ByVal URL As String) As String
    If accountMode = "1" Then
       Return "window.showModalDialog('" & Page.ResolveUrl(Server.UrlEncode(URL)) & "', window,'resizable:yes; scroll:on; status:yes; dialogWidth:750px; dialogHeight:350px; center:yes');"
                Else
        accountMode = ""
        Return ""
    End If

In my aspx file, I have:

<asp:LinkButton id="UpdateButton" runat="server" commandName="Update" Text="Update" OnClientClick='<%# OpenWindowRequest("myurl.aspx") %>'></asp:LinkButton>

I also attempted calling the OpenWindowRequest function on the FormUpdating event, but unfortunately, the window does not open.

Answer №1

Your link button is not displaying correctly. Make sure to set the OnClientClick property in the code behind during Page_Prerender. Also, there seems to be a typo with "Rquest" in your method names.

UpdateButton.OnClientClick = OpenWindowRequest("myurl.aspx")

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Updating a form field dynamically with AJAX in Laravel

I'm working on updating the field $medic->current based on certain logic that I have in mind. I'm quite new to using AJAX and would appreciate a little guidance to kick things off. In my code, I am calculating the difference between two dates ...

Unable to delete item using DELETE method

I recently created a WebApi controller with a method designed to delete clients... [HttpDelete] public void DeleteClient(int id) { // implementation } Now I'm attempting to test this functionality by incorporating the following HTML into a webpage ...

Is there a specific event that is triggered when a user accesses a page, other than Application_BeginRequest in the Global.asax file?

Is there a way to log data each time a visitor navigates to a page without having to manually code it in every single page? I attempted using the Application_BeginRequest event, but it seems to fire twice for every page visit. Any suggestions on how to a ...

Encountering the error of receiving "$ undefined," despite making a reference to the library

I have included the JQuery library in the following way: <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script> Despite trying to download the library and include it locally in my project, I ...

The player clicks once and the game is played two times

Struggling with a coding issue here. I've got some code where you click on an image and if it can be moved to the next cell, it should move. function changecell(a){ var moved=false; if(a%3 !=0) { if(ij[a-1]==0) { moved=true; ...

What is the best way to send JSON data from Express to a JavaScript/jQuery script within a Pug template?

Currently, I am facing a challenge in passing JSON data from an Express route to a .js file located within a .pug template. I have been attempting to solve this issue using the following method: The router: // Office Locations router.get('/office_lo ...

Storing the value from the INPUT field in the state of React is not permitted

I'm attempting to retrieve the user input value from the INPUT field and update it in the corresponding state. However, no matter what I type in the field, it doesn't get set to the state. createForm(x){ var dx = 'd'+x let da ...

Error: Incompatibility - The variable is not functioning properly in node.js or express.js

Upon encountering the error message "TypeError: undefined is not a function," I called a callback with parameters null, array_reply, and threadResults. It appears that this section of code is problematic, but I am uncertain why. Your assistance in resol ...

Compatibility problem arising from the versions of ember-precompile, ember.js, and handlebars.js

Having trouble reading the precompiled templates in my HTML due to compatibility issues between ember-precompile, ember.js, and handlebars.js. My code looks like this: Includes the following files. <script src="../js/libs/jquery-1.10.2.js"></sc ...

Retrieve information from another table based on specific criteria using Entity Framework and ASP.NET Core

I am looking to retrieve all posts where the images are marked as Approved false. Below are my two Models, Post and Image models: public class Post { public Post() { Images = new List<Image>(); } public int Id { get; set; } p ...

Is it possible to effortlessly associate a personalized string with an identifier within an HTML element utilizing Angular2?

Check out this cool plunker import {Component} from 'angular2/core' @Component({ selector: 'my-app', template: ` <div *ngFor="#option of myHashMap"> <input type="radio" name="myRadio" id="{{generateId(option[& ...

Trigger a specific drop-down menu to appear upon selection of a radio button using AngularJS

Let me start by presenting my problem, accompanied by a simple piece of code: <body> <div> <input type="radio" name="salary"/>Per Year <select> <option value="0">All</option> ...

What is the process for accessing a file within a NWJS or Electron application?

Imagine a notepad app with editing capabilities that utilizes the Code Mirror library. Since the app is built using NWJS, I am unsure how to directly open a text file within my app. In other native apps, you can typically select an option in the context ...

Find a specific number within an array using Javascript, and if it is not found, return the closest

In Javascript, I want to find a number in an array. If the number does not exist in the array, I need to return a number that is lower than the target number. ...

Manipulate a property within an array using JavaScript and AngularJS

I am working with an AngularJS model that looks like this: $scope.Model = { Users : [{ UserId: '', FirstName: '', LastName: '' }], Products :[{ ProductId: '', ...

Collapse a previously used item when a new item is opened within Angular

I've managed to create a tree structure for a sideBar Menu using this code, and it's working well. However, what I'm trying to achieve is that when a menu with submenus is expanded and the user clicks on another parent menu, the expanded sub ...

The HTML element failed to be inserted

Currently, I am involved in a project based on .NET Core for my organization. This project entails loading work orders from our SQL database using Entity Framework and then filtering them to display as markers on a map via the Google Maps API for our insta ...

Tips for creating a for loop in a .js script within MongoDB that allows for passing a variable containing the database name to a text file

In a .txt file, I have a list of database names as shown below: local test admin Is there a way to dynamically pass arguments instead of hardcoding them in .js scripts for mono go? db = db.getSiblingDB('test'); date = new Date() dat ...

Interrupted Exception in Azure Mobile Services EasyApi for Java

I have implemented a new simple API named "test" in my MobileService. Currently, I am attempting to make a request from Android to fill my passed object: Exists result = mClient.invokeApi("test","ID" ,Exists.class).get(); The structure of my 'Exi ...

Achieving top-tier efficiency in segmenting items within an array of objects

Looking for a way to decrease the size of an array directly on my NodeJS server's memory. I aim to optimize network traffic by sending only the essential 'header' details of each object within the array. The current array on the server look ...