Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hello guys,

Please help me out here.
I have a webform and it has got quite a few fields but there is one radio button list "Report" with yes or no.. and it has button generate email. What i want is when the user selects yes and clicks on generate email, an email should be generated and after that the button should get disabled permenantly no matter if the user visits the page even after 2 days the button should be disabled.
And also if the user selects no and clicks the email button it should not generate email but again it should disable the button permenantly.
Looking forward to your coorporation as always.

Thanks

What I have tried:

I have tried searching google but there is no example or problem reported previously similar to mine.
Posted
Updated 18-Oct-16 22:27pm

Hello ,
If you are using database , then simply store one bool status to check whether button was clicked or not .Suppose ,the button was clicked and you store 'True' in database table. Now , in pageload just check whether the value was 'True' or 'False' . If it is 'True' then disable it otherwise it should be enabled .

To disabled a button from server side
btn.Enabled = false;
Thanks
 
Share this answer
 
Comments
Faran Saleem 20-Oct-16 3:05am    
Hello Animesh,

Thanks a ton for your reply.
That is really helpful but just one issue here when i click on generate email button the bool value will get saved to the same tablee and the table has also got a primary key that is TransactionID so i would need to add the TransactionID with that bool value aswell because primary key cannot be null.
But the page has got another button which is save details and after generating email and filling out rest of the information the user will save the details.. so how can i do that.. as another record with same details will be added also i do not want to keep updating the same record after every button click that means my transactionID will keep on updating itself. I want the transactio nID to be saved inly once.
Also please note that transactionID is being generated at button click i have generated a uniqueNumber in save details which is being added in the database.. and to add generate email records in the database i would need to generate the transactionID there aswell.

I hope i have explained correctly..if you find any query please let me know. I will try and clear it.



Thanks
You may consider following approach-
1. Create a table in the database to store the information of whether the email is being already sent or not. Or you can just insert a row with unique info from the context.
2. At page load, hit database to see if the email is sent or not and accordingly disable or enable the button.

Work on this logic and if you face any problem please let me know so that I'll try to guide you further.

Hope, it helps :)
 
Share this answer
 
Comments
Faran Saleem 20-Oct-16 3:01am    
Hello suvendu

Thanks a ton for your reply.
That is really helpful but just one issue here when i click on generate email button the bool value will get saved to the same tablee and the table has also got a primary key that is TransactionID so i would need to add the TransactionID with that bool value aswell because primary key cannot be null.
But the page has got another button which is save details and after generating email and filling out rest of the information the user will save the details.. so how can i do that.. as another record with same details will be added also i do not want to keep updating the same record after every button click that means my transactionID will keep on updating itself. I want the transactio nID to be saved inly once.
Also please note that transactionID is being generated at button click i have generated a uniqueNumber in save details which is being added in the database.. and to add generate email records in the database i would need to generate the transactionID there aswell.

I hope i have explained correctly..if you find any query please let me know. I will try and clear it.



Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900