473,394 Members | 1,787 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,394 software developers and data experts.

Day name of date object not working

In my csharp code behind file, I'm trying to perform a redirect if the
date a user queries is a Wednesday:

string rqs = Request.QueryString["txtboarddate"];
string rqsday;
rqsday = (System.String.Format("{0:dddd}",rqs)) ;
if(rqsday == "Wednesday")
{
Response.Redirect("http://www.anothersite.com");
}

...but when the date (take today which is a Wednesday) is queried from
the prior page (everything on that page is formatted correctly because
it works when pointing to other functions of the script), I do not get
the redirect. When I comment out the "if" coding, the redirect does
work.

????
..Net Sports

Nov 19 '05 #1
4 1124
..Net Sports wrote:
In my csharp code behind file, I'm trying to perform a redirect if the
date a user queries is a Wednesday:

string rqs = Request.QueryString["txtboarddate"];
string rqsday;
rqsday = (System.String.Format("{0:dddd}",rqs)) ;
if(rqsday == "Wednesday")
{
Response.Redirect("http://www.anothersite.com");
}

..but when the date (take today which is a Wednesday) is queried from
the prior page (everything on that page is formatted correctly because
it works when pointing to other functions of the script), I do not get
the redirect. When I comment out the "if" coding, the redirect does
work.

????


Find out what rqsday contains. If using VS, then debug the project.
Otherwise, set the value to a label's Text property, or response.write the
value.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Nov 19 '05 #2
It doesnt give me any errors when running from debug mode in VS. It's
just that 'rqsday' seems not to be picking up the day of the week name
I'm assigning it. How would I check a response.write if I'm doing this
in a code behind file. I try doing
if(rqsday == "Wednesday")
{
Response.Write("hello world");
}

but cannot see where (of if) it is getting printed.

Nov 19 '05 #3
..Net Sports wrote:
It doesnt give me any errors when running from debug mode in VS.
Since you're using VS, just set a breakpoint and inspect the variable when
the process "breaks". Or set a Watch on the variable. Or use the Immediate
window to check its value.

Do you need some information on debugging?
It's
just that 'rqsday' seems not to be picking up the day of the week name
I'm assigning it. How would I check a response.write if I'm doing this
in a code behind file. I try doing
if(rqsday == "Wednesday")
{
Response.Write("hello world");
}

but cannot see where (of if) it is getting printed.


You're using Grid placement, right? The text is probably "underneath" one of
the controls on your page. Do a View Source to see it.

You should put a label on the page temporarily and set its Text property to
the value instead of writing it to Response.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Nov 19 '05 #4
Thanks, I'll check it out

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
1
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported...
6
by: Trevor Hartman | last post by:
Hi, I need to refer to my objects dynamically. I have a 7 table cells (sunCell, monCell, tueCell....). I am looping through some data, checking its date and adding it to the correct cell. I...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
2
by: bryan.a.fowler | last post by:
I'm really new working with VB.net and I'm working on a simple program with a date input. I've got a couple of questions; 1) I'm using a DateTimePicker to show both the user inputted date as...
4
by: sck10 | last post by:
Hello, What I am trying to do is get the string(August) from: hdnMonth.Value = DateTime.Now.Month.ToString(); Does c# have a function like the vb function "MonthName" ? hdnMonth.Value =...
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
4
by: TS | last post by:
i am wondering why the name of the controls are listed in parameters of request object instead of ID. The name always uses the default '$' for encapsulations and the ID uses '_'. When i use...
10
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Hi everybody, I'm trying to use the new VB 2008 right now and I want to know how to preset the company name and copyright informtion in Assembly Information. In my current VB 2005, company name...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.