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

Loop through Datatable and call Modal popup if data not exists

When looping through datable, I am inserting record to DB.  At the same time, I am validating if data "Fedex Rep" from datatable exist in Representative table. If not, I want a Modal screen to pop up, with Gridview. This is for a user to  select Representative name. Afterward, goes to the next row in datatable. I am not sure if possible.
I can use Modal popup with Gridview and allow user to select data from Gridview. How can I trigger Modal to popup while looping through datatable?



1. Loop through Datatable, get representative name ("Fedex Rep")  and others values
2. validate if "Fedex Rep" exists in Representative table
    - if Fedex Rep exists, insert data to ShipmentRequest table with other values
   - if Fedex Rep not exists, pop up Modal ajax control, and allow user to select Rep name from   Gridview
      - insert to DB and  continue looping
 
 
0
VBdotnet2005
Asked:
VBdotnet2005
  • 6
  • 3
1 Solution
 
VBdotnet2005Author Commented:
Fedex rep is a column name in datatable.
0
 
srikanthreddyn143Commented:
Why don't you check the Fedex rep before inserting the data?

Loop through datatable and check for Fedex rep.

If no rep  show modal popup

Again need to loop through datatable, if everything looks fine, then start inserting in another for loop.

Code should look something like this!!

Sub Save()

For each prow as datarow in datatable
Check for rep
If no rep show a message and exit sub
Next
For each prow as datarow in datatable
Insert row
Next


End sub

Thanks
0
 
VBdotnet2005Author Commented:
Here is my datatable

accountnumber   fedexRep   shipmentdate county state zip orderby
12345                  john doe     5/13/2011      Springfield    ca   jsmith
etc

I am checking john doe if exist on my Representative table,
 if john doe exists,
    insert 12345                  john doe     5/13/2011      Springfield    ca   jsmith
to my Clientorder table

if he does not
 Modal display, allows a user to select other rep or  insert john doe to Representative table
  then insert  12345                  Tom Jones(if user select a different name)    5/13/2011      Springfield    ca   jsmith

#1, I can loop and check rep, no problem, then display Modal pop up and exit?
Could you show me how to do in code behind? I am not 100% sure what you meant.
Sub Save()

1. For each prow as datarow in datatable
Check for rep
If no rep show a message and exit sub
Next
2. For each prow as datarow in datatable
Insert row
Next
End sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
VBdotnet2005Author Commented:
The main reason why I am checking Rep name first is the sometime clients send rep like this

john doe
or john a doe
or jdoe

This is just a sample, Basically, this is the same rep.
0
 
VBdotnet2005Author Commented:
i would like to see code behind for sample.
0
 
dejaanbuCommented:
if i understand ur req correctly,    you can show the modalpopup , in code behind like

For Loop
       if (Condition)
            (YOUR MODEL POPUP ID).show()
            Exit For
       End if
Next

Open in new window

0
 
VBdotnet2005Author Commented:
For Loop
       if (Condition)
            (YOUR MODEL POPUP ID).show()
            Exit For                                           << what if there are a few that can't find, this wouldn'  work,   would it?
       End if
Next
For Loop
      Loop through Datatable from row 1 to the end and insert row in DB?
Next
0
 
srikanthreddyn143Commented:
Ya that should be the way. See this link for msg box.

http://www.codeproject.com/KB/webforms/NingLiangSimpleControl.aspx
0
 
VBdotnet2005Author Commented:
0
 
srikanthreddyn143Commented:
ya you can use that.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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