Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hai all,
In my project there is a customer.aspx page and Listofcustomer.aspx page.While Clicking on Save button the validation function will fire.

javascript fn (Pop up function)
--------------
XML
function TextChanged() {
     if (Page_ClientValidate()) {

         document.getElementById('<%= btnEmpfangSave.ClientID%>').setAttribute("onClick", "return ShowPopup(this,'<%= btnYesPopup2.ClientID %>','','modaldvPopup2','<%= lnkClosePopup2.ClientID%>',1)");
     }
 }


Then I called this function in each textbox's in customer.aspx page .(If I click on 'Yes' All the values will be saved into master data.if No it will not save the data into master data table.)


XML
<asp:TextBox runat="server" ID="txtEmpfangOrt" class="txtBox" TextMode="SingleLine"
                                                       TabIndex="5" onchange="TextChanged()"></asp:TextBox>


Listofcustomer.aspx will have a grid for listing all customer details,In grid there is a link button to redirect the page to customer.aspx page with corresponding details.
These all are working fine...

Now my question is I want this (Pop up function) while directly clicking on customer.aspx page save buton ,but should not asked this pop up if I am selecting the data from Listofcustomer.aspx page.

How can I solve this?
Please help !!!!


Regards
jithesh
Posted
Updated 27-Oct-14 22:44pm
v2

1 solution

If it is limited to two pages only then you can do it by checking the current page name and make the function to behave differently by page name like ":-

For Customer.aspx page to view the confirmation message and not for all other pages.

Ex :-

JavaScript
document.location.href.match(/[^\/]+$/)[0].indexOf('customer.aspx')>-1


One extra check can be added to teh code for save button click :-

Ex :


JavaScript
function TextChanged() {
     if (Page_ClientValidate()) {
 		if (document.location.href.match(/[^\/]+$/)[0].indexOf('customer.aspx')>-1) {
         document.getElementById('<%= btnEmpfangSave.ClientID%>').setAttribute("onClick", "return ShowPopup(this,'<%= btnYesPopup2.ClientID %>','','modaldvPopup2','<%= lnkClosePopup2.ClientID%>',1)");
	}
     }
 }



Hope this will definitely of help to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900