Bind a Status Column in gridview on basis current Date
I have customer registration form in that iam not using any status field n not saving it in data base so when iam retrieving records from this table then how to bind one extra column named 'Status' and values will be (Active and AutoHold) on the basis of CurrentDate which have compare with 'ActiveDate' which iam using field in my registration form and saving it into database table.


Khargesh RajputRank #616 · 3.9K reputationPosted Mar 10, 2015, 11:20 PM EDT
Declare @Status varchar(20)
here get Activedate on any variable an compare as
if(Activedate>=getdate())
set @Status='Active'
else
set @Status='Autohold'
and write query to select data for gridview .
here Use Status=@Status
Azaad Abbas127 reputationPosted Mar 10, 2015, 11:48 PM EDT
Azaad Abbas127 reputationPosted Mar 10, 2015, 11:54 PM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Mar 11, 2015, 12:05 AM EDT
Azaad Abbas127 reputationPosted Mar 11, 2015, 1:24 AM EDT
set @Status='Active'
else
set @Status='Autohold'
before updating ,,then after update it I can retrieve as updated value..
Khargesh RajputRank #616 · 3.9K reputationPosted Mar 11, 2015, 1:32 AM EDT
Azaad Abbas127 reputationPosted Mar 11, 2015, 1:37 AM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Mar 11, 2015, 2:08 AM EDT
set @Status='Active'
else
set @Status='Autohold'
then update status=@status