473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Check The GridView Records

I have a 3 GridvViews one is To,another one is Cc and Bcc ,
After enter the values to Grids,i want to save those Records.
Now what is my question is ---at the time of saving Check the data is there in 3 Grids or not.

ex:
i insert records to To,but i'm not insert records to Cc,Bcc ,then it shows the "error enter atlest one record..." .I want like this for this i wrote Script function and call the Script in to Save button by using OnClientClick Property.

Expand|Select|Wrap|Line Numbers
  1. <JavaScript >
  2. function Validate() {
  3.             var To = document.getElementById("<%= gvTo.ClientID %>");
  4.             var Cc = document.getElementById("<%= gvCc.ClientID %>");
  5.             var Bcc = document.getElementById("<%= gvBcc.ClientID %>");
  6.  
  7.  
  8.             if (To.rows.length < 1 || Cc.rows.length < 1 || Bcc.rows.legth < 1) {
  9.                 alert("please enter at least one record");
  10.             }
  11.             else {
  12.                 alert("Continue..");
  13.             }
  14.         }
  15. </JavaScript>
  16.  
Aug 4 '12 #1
1 2061
Mudassir
85 64KB
well you can accomplish by taking a hidden field, and on row created and row deleted events of the grid view update the hidden filed say if the row is created increment the value of hidden field by 1 and when the row is deleted decrement it by 1. and now in javascript function you can do it as
Expand|Select|Wrap|Line Numbers
  1. <script type ="text/javascript">
  2. function Check(){
  3. var chk=(document.getElementById{"<%=myHiddenField.ClientID%>").value);
  4. if(chk=="" || chk=="0")
  5. {
  6. alert("Please Enter");
  7. return false;
  8. }
  9. else{
  10. return true;
  11. }
  12. }
  13. </script>
  14.  
...
Addan
Aug 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: scousineau | last post by:
There could be 50 vendors which we are going to send payments to, and each vendor could have up to 100 records on the table for payment. I need a method to enter a check# once then the system would...
5
by: Tony | last post by:
Every 10 seconds I need to search a SQL table for orders to print. The orders are created through WebForms on ASP.NET clients. The orders should not print until 10 minutes before they are due. ...
2
by: Steve | last post by:
One of the columns in my gridview is a blank textbox (I have added it as a template field). Users can enter a number in the textbox for a multiple of the gridview records. I have a submit button...
3
by: wongray | last post by:
Hello, I need help. I have a form and I would like to do a check when I enter a data into the field and once I press enter into the field it will check whether is duplicate or not. currently...
3
by: hr833 | last post by:
I'm trying to check for duplicates from 2 table based on 2 fields. For example if the year and month is the same for table A and Table B then i will not import the record from Table B to Table A. ...
1
by: elbatz | last post by:
Can somebody help me? How do I know if records in Table1 are also in Table2, using VB6 code? For example: If Table1 has 1111 in column1 and also Table2 has 1111 in column2 msgox "Existing...
3
by: moorcroft | last post by:
Hi I am trying to write some sql to because we have a missing foregin key constraint. The following is what I have been asked to do: 1. COMPULSORY_WORK.reference to LISTED_BUILDING.reference ...
1
by: krunalkakadia | last post by:
hi all, i have my print linkbutton in gridview column.when i click on it i need to print the selected record. how can i print selected gridview records?is there any code for the same then give...
3
by: wideturn | last post by:
Hello, I am trying to check to see if records exists before inserting them into a table with a sql statement. I am using variables retrieved from a form and I can insert new records fine but when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.