Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 18, 2012 10:48 AM by coolpal9
Apr 10, 2012 10:39 AM|LINK
im calling based on your condition.
Apr 10, 2012 10:55 AM|LINK
Thanks a lot! Its working! i ran code without checking conditions.
How shall I check for the condition? I am not getting it. I want the page to be disabled:
1. when the page has been already visited for the day and "submit" button has been clicked
2. on certain days (like weekends) it should be disabled
Apr 10, 2012 11:19 AM|LINK
in such cases you need to store the values or set a flag value in your database for the day, if the flag value is up for that user in your database, then in page load you will disable the page. to be precise you also need to create a database schema for
user wise day wise flag entry,.
Apr 10, 2012 11:41 AM|LINK
I already have the list of holidays in my database. But the point is that I don't know how to use them at this moment, as a condition to disable the page...?
I fetch the holidays through stored procedures. But here I don't know how to code for the condition?
Apr 10, 2012 11:55 AM|LINK
its pretty simple, just check the current day using datetime.now. later iterate with the list of holidays that you got in a dataset or datareader to search the entry of current date, if you get any date like such, call the Popup method and break the code
Apr 10, 2012 12:01 PM|LINK
Yes I have the holidays in a DataSet.
Do you mean that by showing:
something like this the condition will be met?
Can you pl help me out in the code?
Apr 10, 2012 12:21 PM|LINK
i think you can use code like below:
public partial class SomeJunk_DisablePage_DisablePage : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack) // here you can write your code to check user visits to show or hide the script
DateTime _dt = DateTime.Now;
DataSet _dset = LoadDataSet();
foreach (DataRow _dr in _dset.Tables.Rows)
DateTime dtRow = Convert.ToDateTime(_dr["Holiday"].ToString());
if (dtRow.Month == _dt.Month && dtRow.Day == _dt.Day && dtRow.Year == _dt.Year)
ClientScript.RegisterStartupScript(this.GetType(), "s", " Popup('Hello');", true);
public DataSet LoadDataSet()
DataSet _dset = new DataSet();
for (int i = 0; i < 6; i++)
DataRow _dr = _dset.Tables.NewRow();
_dr["Holiday"] = DateTime.Now.AddDays(i);
Apr 10, 2012 12:31 PM|LINK
Apr 11, 2012 05:08 AM|LINK
Got it run!
Apr 11, 2012 06:24 AM|LINK
The code works but only once. When I execute it again for checking conditions, it again restricts me from viewing...
How to solve this problem?