Solved

C# - Datagrid - Javascript

Posted on 2013-02-06
6
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 13

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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

632 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