M
Mark
Hi, I am playing around with creating custom server controls for use within
a ASP.NET page.
I am creating a contact form and have the following question
I am capturing the form postback data in a routine called LoadPostData that
has the following signature and which implements the IPostBackDataHandler
event handler
public bool LoadPostData(string postDataKey,
System.Collections.Specialized.NameValueCollection postCollection)
{
}
If I examine the postCollection collection and pass in the uniqueID
(postDataKey) of my control, I do in fact retrieve the information entered
in the contact form, delimited by a "," character.
e.g my custom control has input fields
txtName
txtPhone
txtEmail
As a test I entered the following data in the control and pressed the submit
button
Mark
06123456
(e-mail address removed)
In the routine LoadPostData if I do the following
string sData = postCollection[postDataKey];
sData becomes "Mark,06123456,[email protected]"
so the information is captured correctly.
What I would like to be able to do is query each of the text objects
(txtName, txtPhone, txtEmail) and retrieve their individual values (Like
Request.Form("txtName") in classic ASP).
Failing that, I was thinking that I could just do a split on the returned
data ("Mark,06123456,[email protected]" in the above example) using the ","
character and then examine the array. The problem with this is if someone
enters a "," character in any of the textfields then the split would not be
accurate.
Is there a way that I can suggest the delimiter ("|" for example) used
instead of a "," character?
e.g
Data is returned as "Mark|06123456|[email protected]"
Thanks in advance
Cheers
Mark
a ASP.NET page.
I am creating a contact form and have the following question
I am capturing the form postback data in a routine called LoadPostData that
has the following signature and which implements the IPostBackDataHandler
event handler
public bool LoadPostData(string postDataKey,
System.Collections.Specialized.NameValueCollection postCollection)
{
}
If I examine the postCollection collection and pass in the uniqueID
(postDataKey) of my control, I do in fact retrieve the information entered
in the contact form, delimited by a "," character.
e.g my custom control has input fields
txtName
txtPhone
txtEmail
As a test I entered the following data in the control and pressed the submit
button
Mark
06123456
(e-mail address removed)
In the routine LoadPostData if I do the following
string sData = postCollection[postDataKey];
sData becomes "Mark,06123456,[email protected]"
so the information is captured correctly.
What I would like to be able to do is query each of the text objects
(txtName, txtPhone, txtEmail) and retrieve their individual values (Like
Request.Form("txtName") in classic ASP).
Failing that, I was thinking that I could just do a split on the returned
data ("Mark,06123456,[email protected]" in the above example) using the ","
character and then examine the array. The problem with this is if someone
enters a "," character in any of the textfields then the split would not be
accurate.
Is there a way that I can suggest the delimiter ("|" for example) used
instead of a "," character?
e.g
Data is returned as "Mark|06123456|[email protected]"
Thanks in advance
Cheers
Mark