Please tell me how I can get the values and items for a form posted using
the post method.
The posting page is HTML and I won't know what's in it ahead of time...
How can I get a item/value pair for it.
I'm sure it is simple but haven't figured it out.
Thanks
ShaneWould somethin glike this work?:
Dim idict As System.Collections.IDictionaryEnumerator = CType(Request.Form,
System.Collections.IDictionaryEnumerator)
While idict.MoveNext
Dim key As String = CStr(idict.Key)
Dim value As String = CStr(idict.Value)
End While
Karl
"SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
mail> wrote in message news:%23i9iyr5VDHA.2544@.tk2msftngp13.phx.gbl...
> Please tell me how I can get the values and items for a form posted using
> the post method.
> The posting page is HTML and I won't know what's in it ahead of time...
> How can I get a item/value pair for it.
> I'm sure it is simple but haven't figured it out.
> Thanks
> Shane
give me this...
Specified cast is not valid.
I can't imagine why this should be so ridiculous nor can I found information
on it.
I need info from an HTML page, not the same ASPX page and it will be POST
instead of GET.
I looked at request.form.key, .getvalues.
Not sure what they do and can't find explanation
if you have any more ideas please let me know..
Thanks a bunch,
Shane
"Karl Seguin" <kseguin##crea.ca> wrote in message
news:OJJS1v5VDHA.2364@.TK2MSFTNGP09.phx.gbl...
> Would somethin glike this work?:
> Dim idict As System.Collections.IDictionaryEnumerator =
CType(Request.Form,
> System.Collections.IDictionaryEnumerator)
> While idict.MoveNext
> Dim key As String = CStr(idict.Key)
> Dim value As String = CStr(idict.Value)
> End While
> Karl
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:%23i9iyr5VDHA.2544@.tk2msftngp13.phx.gbl...
> > Please tell me how I can get the values and items for a form posted
using
> > the post method.
> > The posting page is HTML and I won't know what's in it ahead of time...
> > How can I get a item/value pair for it.
> > I'm sure it is simple but haven't figured it out.
> > Thanks
> > Shane
Request.Form is a NameValueCollection, containing the names and values of
all the form fields in the form that posted to the current Page. All you
have to do is iterate through it.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.
"SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
mail> wrote in message news:%23i9iyr5VDHA.2544@.tk2msftngp13.phx.gbl...
> Please tell me how I can get the values and items for a form posted using
> the post method.
> The posting page is HTML and I won't know what's in it ahead of time...
> How can I get a item/value pair for it.
> I'm sure it is simple but haven't figured it out.
> Thanks
> Shane
Thanks a million... Whew... The docs said it lists all forms on a page so I
was thrown off..
for anybody else who needs to know the easy way of doing this is:
dim i as short
For i = 0 To Request.Form.Count - 1
Response.Write(Request.Form.Keys(i) & "=" & Request.Form.Item(i) & &
"</br>")
Next i
"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:uB31615VDHA.2368@.TK2MSFTNGP09.phx.gbl...
> Request.Form is a NameValueCollection, containing the names and values of
> all the form fields in the form that posted to the current Page. All you
> have to do is iterate through it.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Complex things are made up of
> lots of simple things.
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:%23i9iyr5VDHA.2544@.tk2msftngp13.phx.gbl...
> > Please tell me how I can get the values and items for a form posted
using
> > the post method.
> > The posting page is HTML and I won't know what's in it ahead of time...
> > How can I get a item/value pair for it.
> > I'm sure it is simple but haven't figured it out.
> > Thanks
> > Shane
Showing posts with label method. Show all posts
Showing posts with label method. Show all posts
Saturday, March 24, 2012
Thursday, March 22, 2012
newbie namespace question
Hi,
I'd like to place a method in a namespace which I can easily call from any of my asp.net pages.
The method formats a string, and I'd like to just call it with a string without instantiating a new object ie:
string Message = "hello world";
Message = MyNameSpace.MyMethod( Message );
How can I do this? Thanks - Katie.To do this is VB you use "Shared." Example:
Public Shared Function MyMethod(ByVal Message As String) as String
'Method body
End Function
-John
"katie" <pe_date@.hotmail.com> wrote in message
news:79C7038A-5CB3-4D52-9E32-69D50C8C2663@.microsoft.com...
> Hi,
> I'd like to place a method in a namespace which I can easily call from any
of my asp.net pages.
> The method formats a string, and I'd like to just call it with a string
without instantiating a new object ie:
> string Message = "hello world";
> Message = MyNameSpace.MyMethod( Message );
> How can I do this? Thanks - Katie.
Hi Katie,
In a method is not a member of a namespace, it is a member of a class. What
you want to do is create a class and create a static member within the
class, this is often referred to as a class member as apposed to an instance
member.
public class StringMethods
{
public static string MyMethod( string message )
{
// Do your thing here...
return ...
}
}
Then invoke the method using the following syntax
string Message = "hello world";
Message = StringMethods.MyMethod( Message );
Hope this helps
--
Chris Taylor
http://dotnetjunkies.com/WebLog/chris.taylor/
"katie" <pe_date@.hotmail.com> wrote in message
news:79C7038A-5CB3-4D52-9E32-69D50C8C2663@.microsoft.com...
> Hi,
> I'd like to place a method in a namespace which I can easily call from any
of my asp.net pages.
> The method formats a string, and I'd like to just call it with a string
without instantiating a new object ie:
> string Message = "hello world";
> Message = MyNameSpace.MyMethod( Message );
> How can I do this? Thanks - Katie.
I'd like to place a method in a namespace which I can easily call from any of my asp.net pages.
The method formats a string, and I'd like to just call it with a string without instantiating a new object ie:
string Message = "hello world";
Message = MyNameSpace.MyMethod( Message );
How can I do this? Thanks - Katie.To do this is VB you use "Shared." Example:
Public Shared Function MyMethod(ByVal Message As String) as String
'Method body
End Function
-John
"katie" <pe_date@.hotmail.com> wrote in message
news:79C7038A-5CB3-4D52-9E32-69D50C8C2663@.microsoft.com...
> Hi,
> I'd like to place a method in a namespace which I can easily call from any
of my asp.net pages.
> The method formats a string, and I'd like to just call it with a string
without instantiating a new object ie:
> string Message = "hello world";
> Message = MyNameSpace.MyMethod( Message );
> How can I do this? Thanks - Katie.
Hi Katie,
In a method is not a member of a namespace, it is a member of a class. What
you want to do is create a class and create a static member within the
class, this is often referred to as a class member as apposed to an instance
member.
public class StringMethods
{
public static string MyMethod( string message )
{
// Do your thing here...
return ...
}
}
Then invoke the method using the following syntax
string Message = "hello world";
Message = StringMethods.MyMethod( Message );
Hope this helps
--
Chris Taylor
http://dotnetjunkies.com/WebLog/chris.taylor/
"katie" <pe_date@.hotmail.com> wrote in message
news:79C7038A-5CB3-4D52-9E32-69D50C8C2663@.microsoft.com...
> Hi,
> I'd like to place a method in a namespace which I can easily call from any
of my asp.net pages.
> The method formats a string, and I'd like to just call it with a string
without instantiating a new object ie:
> string Message = "hello world";
> Message = MyNameSpace.MyMethod( Message );
> How can I do this? Thanks - Katie.
Subscribe to:
Posts (Atom)