473,788 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Javascript from ASP NET

74 New Member
Hi Can anyone help me?

I have a Javascript function in my test.aspx as follow:-

<script language="Javas cript">

function confirm_save()
{
if (confirm("Are you sure you want to save this changed?")==tru e)
return true;
else
return false;
}

</script>


Note:-
1. I know this can be called by <input .... type BUTTON and
2. <linkbutton.. ..
3. <asp:button.. ..


BUT My case is different, as follows:-

I have a datagrid to display in the test.aspx, the datagrid have a EDIT button, and this button is not customize by me, when I configure property builder of the datagrid, I simply add it (template column).


If you take a look at the HTML test.aspx, you can notice below:-


<TR>
<TD bgColor="inacti vecaptiontext" colSpan="2"><as p:datagrid id="datagrid" runat="server" CssClass="boldt ext" Width="60%" ForeColor="Blac k" GridLines="Hori zontal" AllowPaging="Tr ue" CellPadding="4" BorderWidth="1p x" BorderStyle="No ne" BorderColor="#C CCCCC" AutoGenerateCol umns="False" BackColor="Whit e" OnCancelCommand ="OnCancel" OnUpdateCommand ="OnSave" OnEditCommand=" OnEdit">

<AlternatingIte mStyle ............... .
<asp:BoundColum n....
<asp:BoundColum n....
<asp:EditComman dColumn ButtonType="Pus hButton" UpdateText="Sav e" CancelText="Can cel" EditText="Edit" ></asp:EditCommand Column>

</asp: datagrid>
</TR>


and this is all automatice by datagrid, because, when I click edit, it will run the code ->, refer to OnEditCommand=" OnEdit" above.

public void OnEdit(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
datagrid.EditIt emIndex = -1;
BindData(); }


THEN THE Save and Cancel Button are automatically appear. after click Edit Button.


Then I can change value on the Non-Readonly datagrid column, after change, when I click save, it will trigger OnSave method in my code behind.refer to OnUpdateCommand ="OnSave" above.

>>>>>>
WHAT I REQUIRED ARE:- when I click Save, it will prompt out a confirmation message box. can anyone please help me?
>>>>>>
Feb 14 '07 #1
2 3485
chazcross
31 New Member
*pressed enter early, hang on a minue for my replay.
Feb 14 '07 #2
chazcross
31 New Member
I havent touched a datagrid in a while
But here is what i do in a gridview control
instead of using a editcommandcolu mn change it to a Template and add a button along with the command name.

*The syntax is not the same for a datagrid, but you can figure it out easy in VS


Expand|Select|Wrap|Line Numbers
  1. <asp:TemplateField HeaderText="Delete">
  2. <ItemTemplate>
  3. <asp:LinkButton ID="lnlButtonDelete" runat="server" CommandName="DeleteFile"  OnClientClick="return confirm('Are you sure?')" >Delete Image</asp:LinkButton>
  4. </ItemTemplate>
  5. </asp:TemplateField>
Feb 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4522
by: Julia Briggs | last post by:
Hello World - I admit I'm new to javascript but I've tried for days to find a solution to my problem. Basically I have 3 unique javascript files that do different screen display events that I want to dynamically call, where the current page would then refresh after a user clicks on any one of three associated button links. Could someone please assist me and craft a simple script that would accomplish this feat of impossibility? ...
18
12700
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
5
51483
by: Krishna | last post by:
Hi all, Can i call my javascript functions from the web controls.Any appropriate site which will be tell more on this will be helpfull. Regards.., Krishna
1
1947
by: desmcc | last post by:
Hi, I am launching a modal dialog through the usual javascript (window.showmodaldialog). When the modal dialog is complete (ie user selects OK), the calling page then refreshes itself by setting the location.href of the window to be itself (ie the modal dialog changes a label on the calling page ). I can see that this causes the page load code of the calling page to execute in the code behind page. I can also see clearly that this updates...
4
6336
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB Code: Public Sub VBProcedure() .. ..
13
6716
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is getting as far as the iframe section as other parts of the html code work correctly. But it is not executing any code within the getPage() function as some "hello world" writes within getPage() wouldn't print. ...
3
3581
by: Opa | last post by:
Hi , I have a form with javasript which launches a popup via the showModalDialog() method. I get the dialog to open, now I am trying to first get a reference to the calling form from the popup and then do a refresh of the calling form. Any ideas on how to get a reference to the calling form? I tried window.parent.location.reload() , but it doesn't work. Thanks a lot.
4
2822
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript" src="country_state.js"> </script>
5
3248
by: Newbie Coder | last post by:
Hello all I have 3 functions in a javacrip file (MyScript.js), which is added to an ASP.NET 2.0 project 1) no right-click 2) no select text (copy...) 3) History.Back()' How do I call those 3 functions in all of my pages?
6
10632
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and output parameter. My questions are: a. Can I expose a function in my CSharp code and internally call a javascript function?? Is this a good idea?? b. Do we have any tool which can convert a javascript function into
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.