Javascript Prompt and ASP.NET

J

J.P. Cummins

In my ASP.NET application, I wish to have a page for administrators to
edit items in a list. Preferably, I would like to use the javascript
prompt for the 'rename' function, and a javascript alert box for the
'delete' function. When the user clicks 'rename', the javascript prompt
asks for the new name. When the user clicks 'delete', a javascript
alert asks the user if he really wants to delete that item. Here is an
example of what my list would look like with the functions on the side:

Link
---------------------------------------
google.com [rename] [delete]
msn.com [rename] [delete]
slashdot.com [rename] [delete]

I am not concerned with the java alert message, it is just a simple
function that I can add to the OnClick event. However, I am concerned
with prompting the user when they click 'rename' and sending that value
back to my ASP.NET script. Does ASP.NET have a built-in function to
prompt a user? If not, what are some of your suggestions?
 
C

CMA

hi,

ASP.NET is for run at the server. (c# or vb.net)

so if you need to do this.. really need to use JavaScript.

else you can do the rename in this way.

create a page with a textbox and "Done" button.

when the user click on "rename"...
you can open a small window with JavaScript window.open()..
after DONE, do the DB updates from the button click event of the DONE...then
close the second window... then refresh the first window.

this is just an idea.

hope this helps,
CMA
 
G

Guest

I would have a hidden input on your page that accepts the input from the
prompt, then just submit the form and update the database:

<code>
<script language="javascript">
function buttonClick()
{
var text = prompt('Enter the new name');
document.getElementById('hiddenInput').value = text;
document.forms(0).submit();
}
</script>

<input type="button" id="rename" value="Rename">
<input type="hidden" id="hiddenInput" runat="server" value="">
</code>
 
A

Alex Homer

I built a selection of user controls that create various client-side prompts
and dialogs, and you can reuse these or copy the code. See:
http://www.daveandal.net/books/6744/default.asp
for the main page and download links, or run these examples from the online
examples page:
a.. Alert, Prompt and Confirm Dialogs from a User Control
a.. Browser-Adaptive Dialogs from a User Control
a.. Internet Explorer Dialog Windows from a User Control
a.. Adaptive Dialog Windows from a User Control

Matt Hamilton said:
I would have a hidden input on your page that accepts the input from the
prompt, then just submit the form and update the database:

<code>
<script language="javascript">
function buttonClick()
{
var text = prompt('Enter the new name');
document.getElementById('hiddenInput').value = text;
document.forms(0).submit();
}
</script>

<input type="button" id="rename" value="Rename">
<input type="hidden" id="hiddenInput" runat="server" value="">
</code>

J.P. Cummins said:
In my ASP.NET application, I wish to have a page for administrators to
edit items in a list. Preferably, I would like to use the javascript
prompt for the 'rename' function, and a javascript alert box for the
'delete' function. When the user clicks 'rename', the javascript prompt
asks for the new name. When the user clicks 'delete', a javascript
alert asks the user if he really wants to delete that item. Here is an
example of what my list would look like with the functions on the side:

Link
---------------------------------------
google.com [rename] [delete]
msn.com [rename] [delete]
slashdot.com [rename] [delete]

I am not concerned with the java alert message, it is just a simple
function that I can add to the OnClick event. However, I am concerned
with prompting the user when they click 'rename' and sending that value
back to my ASP.NET script. Does ASP.NET have a built-in function to
prompt a user? If not, what are some of your suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top