Solved

C# - Datagrid - Javascript

Posted on 2013-02-06
6
382 Views
Last Modified: 2013-02-12
I am developing a website that uses a datagrid.  I am familiar with how to loop through the contents of a grid.  The grid structure is similar to below

ID      Product                Price     Qty
1        Brakes Pads        $2.00        1
2        Rotors                $20.00       1
3        Spark Plugs         $4.00       0

What I need is a solution that will accomplish this.  When looping through the grid I will be looking at the QTY columns (which is a textbox).  I know how to do this part!

Here is where I need help:
If I find a quantity of 0 I need to have a pop-up message box display that states:  Do you want any items with 0 Qty to be put in a separate work order?  
If the user says yes then I will create a new work order where Qty = 0.  If no I will delete those items.  
I just need to know: (1) how to get a pop-up box in ASP.NET to display to the user (2) how to call the correct method after the user clicks on either yes or no.  

Please provide code sample.  Thanks
0
Comment
Question by:CipherIS
  • 4
6 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 38861048
Are you doing the looping part in javascript? Also, will there be a submit button in the page, on click of which you will loop through? What happens if there are multiple rows with 0 qty in the textbox.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 38861133
No.  Looping will be done in C#.  

If there are multiple rows I will be creating a list with the ID's for those items and pass the list to a method which will process accordingly.
0
 
LVL 12

Assisted Solution

by:Jitendra Patil
Jitendra Patil earned 150 total points
ID: 38863433
While you are looping around check for the textbox value if you find the value to 0 then call a javascript function from code behind. check the link below for same
Multiple Ways to Call Javascript Function from CodeBehind in ASP.Net

write the appropriate javascript code for confimation and check for the result, if its "Yes" write code for adding new data & if the result is "NO" then write code for deleting the record.

hope this helps.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:CipherIS
ID: 38864803
Ok, that helps but I need the buttons to say Yes / No not Ok / Cancel.
0
 
LVL 1

Accepted Solution

by:
CipherIS earned 0 total points
ID: 38865298
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 38879496
has solution i was looking for
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now