• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

C# - Datagrid - Javascript

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
CipherIS
Asked:
CipherIS
  • 4
2 Solutions
 
informaniacCommented:
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
 
CipherISAuthor Commented:
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
 
Jitendra PatilSr.Software EngineerCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
CipherISAuthor Commented:
Ok, that helps but I need the buttons to say Yes / No not Ok / Cancel.
0
 
CipherISAuthor Commented:
has solution i was looking for
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now