.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

validate the major code from the database in asp.net using c#

Posted By: narasiman     Posted Date: May 25, 2014    Points:5   Category :ASP.Net
In table record as follows,
major_code minor_code
AMC MFA
BMC EFA
PSTF RPST
PSTF RAFF
PSTF RPSCRB

In Gridview record as follows

CourseName Batch Date
MFA 24 jun 2014
EFA 24 jun 2014
RPST 26 jun 2014
RPSCRB 26 jun 2014

in gridview the major code must be in order. if major code(PSTF course ) is there in gridview in between the other than PSTF course (AMC and BMC course) is there.
i want to display the message Only PSTF course must be there.

Sample Excepted output as follows in gridview correct one
Course Name Batch Date
MFA 24 jun 2014
EFA 24 jun 2014

Wrong output as follows in gridview
CourseName Batch Date
MFA 24 jun 2014
EFA 24 jun 2014
RPST 26 jun 2014 (RPST course is there becausethe major_codeis PSTF)

Then i have one button called submit when i click that submit shows message Only PSTF course must there.

for that how can i validate in asp.net using c#.

i want to validate after binding the records into gridview.


Responses
Author: ASPEvil             
Posted Date: June 13, 2014     Points: 20   

Hello,

You need to filter the record you are getting from the database and displaying to the GridView.

Filter it by the following SQL query:-
--------------------------------------
select * from <tablename> where 'major_code' != 'PSTF'

--------------------------------------

With the above sql query, replace the "<tablename>" with your original/required table name.

Now the all the record will be displayed as before, but the record with the "major_code": "PSTF", will not be displayed.



Thanks.



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend