|
I have several date fields in an employment application that will be hosted on our intranet at work. The form is set up currently to email the application to our human resources department in HTML format. I'm using a javascript based calendar control that is populating the textboxes correctly. My problem begins when I try to capture that date in the emailed application. They just don't show up at all. I can see the values in the textbox when I click on submit, but when the email is received, the dates just aren't there. Everything else comes across correctly.
Here is what I've got right now (for just two of the dates):
Dim dtmildateto As Date
I tried this formatting from another group's suggestion, but the date always returns "00/01/0001" no matter whether the date textbox is filled or empty.
dtmildateto = IIf(Request.Form("mildateto") = "", DateTime.MinValue, Request.Form("mildateto"))
Then I tried JUST calling the date from the textbox and for these I get an error that says --
"System.InvalidCastException: Conversion from string "" to type 'Date' is not valid" and points to the first line below...
dtmildateto = Request.Form("mildateto")
My append statement is set up as follows:
ebody.Append(dtmildateto & " " & " to " & dtmildateto & " ")
My textbox with the image for the calendar control is set up as follows:
The end result is if the field is populated, I want mm/dd/yyyy as the format for the date in the email; if the field is empty, then I just want so the tables don't lose their formatting.
What am I missing??
Thanks,
Carla
|
|
|
|
|
Add the property name="mildateto" to the text field.
---
b { font-weight: normal; }
|
|
|
|
|
The project I am working on requires that we send encrypted emails. Using 3rd party software like ASPEncrypt is one way to do it but I was wondering if there was something built within .NET that I could use.
Thanks,
|
|
|
|
|
Hi, could someone help me with a regular expression? I'm wanting to match all words, in a block of text, that are longer than 20 characters, and can contain any character/number or ANYTHING from the ASCII set EXCEPT a space or an HTML angled bracket (<>).
For instance http://www.firingsquad.com/media/hirez.asp?file=/games/battlefield_2142_preview/images/04.jpg would match.
Also the word 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' would match...
...but <a href="http://www.firingsquad.com/media/hirez.asp?file=/games/battlefield_2142_preview/images/04.jpg">a link</a> wouldn't because 'a link' is only 6 characters, stuff inside HTML tags (attributes name and values basically) would be ignored.
I'm basically looking for a way to deal with increadibly long words, which force open P and DIVS to the width of the word, and can thus break my HTML layout. I've researched and researched and found there is no way this can be done with pure HTML/CSS alone and needs some server side solution to handle it, so I'm basically looking for a server side solution. If there is a better way to do this then I'd be greatful to know. Thanks!
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
I'm just adding a feature that's turning out to be more of a bug and a pain in the butt considering there's only ONE thing that keeps it all from working...
This is my third day of using ASP, so don't be surprised if there's a lot i don't know about
So, my question is, how can i use the value of a string (i use "Request.QueryString("grp")" to get the string value) to list (using the For Next loop) the contents of an array in the same name as the value...it seems like VBScript in ASP can handle multiple objects in the same name as long as they are not the same type of an object and that gets in the way...
I'm doing my best to find an answer but i'm not sure if i'm googling for the right thing...
So please suggest something or help me narrow it down to a few tricks that will actually work...
Roswell
"Angelinos -- excuse me. There will be civility today." Antonio VillaRaigosa City Mayor, Los Angeles, CA
|
|
|
|
|
You could use the Eval function to do this, but it's really not efficient, and clearly not safe.
Instead you should rethink what you are doing, and see if there is a better way to do it.
If you need to do it that way, using Select to get the right array is a safe and efficient way:
Select Case Request.QueryString("grp")
Case "dogs": astrList = astrDogs
Case "cats": astrList = astrCats
Case "rats": astrList = astrRats
Case Else: Response.Write "Error: Unknown group." : Response.End
End Select
---
b { font-weight: normal; }
|
|
|
|
|
Thanks...that's exactly what i was reading about just a second ago in the tizag.com ASP tutorial, something i haven't turned to until now... the method looked about right to me so i'm glad to see a more experienced coder suggest it as well...hopefully it will not see an distinction between the value of a string and the value of the array name
Roswell
"Angelinos -- excuse me. There will be civility today." Antonio VillaRaigosa City Mayor, Los Angeles, CA
|
|
|
|
|
RoswellNX wrote: hopefully it will not see an distinction between the value of a string and the value of the array name
Curious about what you mean by that... A value from the query string is always a string. If the contents of the string happens to be the same as the name of a variable, they are still unrelated.
---
b { font-weight: normal; }
|
|
|
|
|
if the two values are equal there's still a chance that it might not identify the array because from what i see VBScript interprets data as objects, and it might still read the string as nothing more than a string even as that is used to select an array by name...
At first i tried to see if it will be able to simply take the value of the query string and use that to select the corresponding array, but i see that it can not take a value of a string and interpret it as the name of an array when used in a function or when generating links. But it works if i simply name the array manually in the For - Next loop.
FYI, he main purpose of the script is to take a query string and identify the array that it corresponds with, containing string values that will be used to generate the links by the For - Next loop)
Roswell
"Angelinos -- excuse me. There will be civility today." Antonio VillaRaigosa City Mayor, Los Angeles, CA
|
|
|
|
|
The value of a string will never be identified as anything in the code. You can put anything in a string, and it won't cause anything to happen. For an example:
a = 42<br />
b = "a = -1"
The variable a still contains the value 42, the string in the variable b is only treated as text.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: The value of a string will never be identified as anything in the code. You can put anything in a string, and it won't cause anything to happen. For an example:
a = 42
b = "a = -1"
The variable a still contains the value 42, the string in the variable b is only treated as text.
yeah, a string is in quotes...that's what makes it look like a string in the system i guess, and what i think my problem is that i somehow let it be classified as a string and keep the quotes, while i want to turn the string value into something of a keyword to pick the right array.
But chances are that 50% of the problem is that i'm wound up and nervous right now, and it makes it that much harder to understand all the material i try to memorize w/o making sense of it beforehand...i remember bits and pieces and i try to compare it to what i know of PHP, but some of it just escapes me
Roswell
"Angelinos -- excuse me. There will be civility today." Antonio VillaRaigosa City Mayor, Los Angeles, CA
|
|
|
|
|
A string literal is written between quotes, but once the string value is assigned to a variable, there are no quotes, it's just a string value. A string is a string, and you can not turn it into an identifier.
You can use the Eval function to evaluate a string as an expression, but I strongly advice against using that. If you evaluate a value from query string without validating it first, your code is wide open for a wide range of attacks. Also IMHO, Eval is Evil. Although it has it's uses in some very rare occasions, mostly it only promotes a backwards way of solving problems.
---
b { font-weight: normal; }
|
|
|
|
|
|
Aside from dealing with UI events (such as OnClick for Buttons) and getting at DataItems in bound controls (such as OnItemDataBound for Repeaters), I'm having a difficult time understanding why one would implement event handlers.
I've spent the last few hours searching Google and the articles and forums in this site, and while I've found plenty of great resources on HOW to implement custom event handlers, I haven't found any that explain WHY I would want to.
For example, one article (in Visual Studio's Help) gave an example of an AlarmClock. The AlarmClock would raise an Alarm event and a listener for that event would execute some code. Why is this model better than simply calling a Ring() method of the AlarmClock class?
Why would this:
protected virtual void OnAlarm(AlarmEventArgs e)<br />
{<br />
AlarmEventHandler handler = Alarm; <br />
if (handler != null) <br />
{ <br />
handler(this, e); <br />
}<br />
}
be better than this:
protected void Ring()<br />
{<br />
}
Any answers (including links to articles) would be very appreciated.
Thanks,
Jorsh
|
|
|
|
|
|
Hello,
First of all let me say I never worked with RSS as a developer.
I am working on a web site where I am displaying news from a database.
This part is done.
Basically, I need to make those same news available as through RSS.
I believe I need to have a XML file available and updated from the
database?
And maybe the database fields should be the same as RSS 2.0 format?
Anyway, could someone advice me on this?
Thanks,
Miguel
|
|
|
|
|
|
Hi,
I need to retrieve a single record from an SQL database and then store each field of the record as a set of variables, in order that i can then display this data on the page via the codebeind.
Im new to .Net 2.0 and am using Visual Studio 2005. I've already created a stored proceedure in SQL database and created an SQLDataSource to retrieve the information. However my problem is that i dont know how to then get the record fields from the SQLDataSource to save them as variables.
Please help.
|
|
|
|
|
I know a long winded way in which you can do this ..
Created a number of distint and simple DataGrids, each which displays ONLY 1 field from that table. They you can toggle each datagrid's visibility on and off.
This method can also be varied in a number of ways using DataLists and what not.
Hope this helps.
|
|
|
|
|
Hi,
Thanks for the answer but this seems a bit too cumbersome and inefficient for the server.
Surely there is a better way to do it? Even if it means hand coding the data retrieval from the Database.
Any ideas?
|
|
|
|
|
By posting this, I have put your hopes up, and for that, I apologise.
Just wanna say that I have no ideas, hope someone has. I would benefit from it too.
Happy Coding..
|
|
|
|
|
Thanks for the idea though. I just need a more robust way to do it.
Anyone got any ideas on how to help?
|
|
|
|
|
|
Ok thanks.
I thought as much. With the advances made over .NEt 1.1 i thought 2.0 might have also dealt with issues like this.
Obviously not, but still it seems 2.0 is a vast improvement in having closed the gap between the ease of using wizards and the difficulty of being able to do stuff a little more complex than eating a banana.
|
|
|
|
|
Hi there,
Just want to add some information to the above two guys, basically there are a couple of ways that you can use to display data in the web page. You can write your code to pull data out of DB then display it in the web page by either setting the UI control's property or bind it to the data-bound control, and at least you need to write two lines of code in the case of data binding:
Line 1: control.DataSource = datasource;
Line 2: control.DataBind;
However, the new version of the ASP.NET, you no longer need to write this code any more. And the new set of data source controls such as SqlDataSource , ObjectDataSource controls ... will handle that for you. Though you can use the datasource control in code to pull data for example calling the Select method the accessing the IEnumerable result, you'd normally use it with the data-bound controls that have the DataSourceID property like GridView, FormView .... That being said, in the case of the controls that do not have the DataSourceID property like TextBox ... you can use your code (or the datasource control) to pull data, then set to the right property of the control in code or use the data binding expression (and remember calling the DataBind method), another option is to choose a container for it like FormView control so that you can configure using a datasource control like SqlDataSource.
|
|
|
|