MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

httpwebrequest vb.net

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet
Author Message
segue



Joined: 08 Aug 2007
Posts: 2

PostPosted: Tue Jan 29, 2008 11:25 pm    Post subject: httpwebrequest vb.net Reply with quote

I'm trying to get an aspx popup calendar control to post its date value to
an asp.net aspx page in the same project. I thought that maybe I could set
a property but the scope of the calendar popup ends on that popup page so now
in asp.net/vb.net I think I need to do an httpwebrequest from the popup aspx
page and post or send the data via http to the target page codebehind and
listen for it as a querystring?

Also I'm not sure what I need to import in order to see httpwebrequest as an
object let alone how to write the syntax in vb.net.

?
_
Public Class HttpWebRequest _
Inherits WebRequest _
Implements ISerializable

Much thanks and I apologize for the ignorance I know that I'm missing quite
a bit here (probably taking the wrong approach).

Archived from group: microsoft>public>dotnet>framework>aspnet
Back to top
View user's profile Send private message
Mark Fitzpatrick



Joined: 08 Aug 2007
Posts: 18

PostPosted: Wed Jan 30, 2008 2:09 am    Post subject: Re: httpwebrequest vb.net Reply with quote

Why do you need to have it post it's data to a page? Why not encapsulate the
logic into a class or function that can be called anywhere? All you need to
do is when the calendar post back, have it pass information to a class or
static method that does what you need. If you are doing something like
selecting a date so that you can then pull up a list of events that occur on
that date, just post back, grab the value, and then redirect to the page
with the information passed in the querystring. You don't need to do
anything fancy to make the querystring, it's just plain text value pairs.


--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression


"segue" wrote in message @microsoft.com...
>
> I'm trying to get an aspx popup calendar control to post its date value to
> an asp.net aspx page in the same project. I thought that maybe I could
> set
> a property but the scope of the calendar popup ends on that popup page so
> now
> in asp.net/vb.net I think I need to do an httpwebrequest from the popup
> aspx
> page and post or send the data via http to the target page codebehind and
> listen for it as a querystring?
>
> Also I'm not sure what I need to import in order to see httpwebrequest as
> an
> object let alone how to write the syntax in vb.net.
>
> ?
> _
> Public Class HttpWebRequest _
> Inherits WebRequest _
> Implements ISerializable
>
> Much thanks and I apologize for the ignorance I know that I'm missing
> quite
> a bit here (probably taking the wrong approach).
>
>
Back to top
View user's profile Send private message
chike_oji



Joined: 13 Dec 2007
Posts: 10

PostPosted: Wed Jan 30, 2008 9:43 am    Post subject: Re: httpwebrequest vb.net Reply with quote

You could implement this by saving the value in a viewstate or session
variable.
This way you do not lose it even after a postback.

You could then go on to construct your url, by concatenation of the
constituent string values, still passing it as a querystring.

The code snippet below would be of help.

string dtDate = String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ViewState["dtDate"] = dtDate;
}
else
{
dtData = (DataTable)ViewState["dtDate"];
}

}

In the event handler or method initialising the viewstate variable
with
the calendar control date value, insert the following statement.

//Save in ViewState
ViewState["dtDate"] = dtDate;

Form your url like that below.
string url = "http://www.blah.com/blah.aspx?date=" + dtDate;

I hope this helps.

Regards,

Chike

On Jan 30, 4:09 am, "Mark Fitzpatrick" wrote:
> Why do you need to have it post it's data to a page? Why not encapsulate the
> logic into a class or function that can be called anywhere? All you need to
> do is when the calendar post back, have it pass information to a class or
> static method that does what you need. If you are doing something like
> selecting a date so that you can then pull up a list of events that occur on
> that date, just post back, grab the value, and then redirect to the page
> with the information passed in the querystring. You don't need to do
> anything fancy to make the querystring, it's just plain text value pairs.
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - Expression
>
> "segue" wrote in message
>
> @microsoft.com...
>
>
>
>
>
> > I'm trying to get an aspx popup calendar control to post its date value to
> > an asp.net aspx page in the same project.  I thought that maybe I could
> > set
> > a property but the scope of the calendar popup ends on that popup page so
> > now
> > in asp.net/vb.net I think I need to do an httpwebrequest from the popup
> > aspx
> > page  and post or send the data via http to the target page codebehind and
> > listen for it as a querystring?
>
> > Also I'm not sure what I need to import in order to see httpwebrequest as
> > an
> > object let alone how to write the syntax in vb.net.
>
> > ?
> > _
> > Public Class HttpWebRequest _
> >    Inherits WebRequest _
> >    Implements ISerializable
>
> > Much thanks and I apologize for the ignorance I know that I'm missing
> > quite
> > a bit here (probably taking the wrong approach).- Hide quoted text -
>
> - Show quoted text -
Back to top
View user's profile Send private message
segue



Joined: 08 Aug 2007
Posts: 2

PostPosted: Wed Jan 30, 2008 5:29 pm    Post subject: Re: httpwebrequest vb.net Reply with quote

I don't think this will work. The popup page with the calendar needs to
update the page that called it. Yet, if you think of it as inline
processing, the popup page is the last thing that gets processed, so the
textbox control from the original page is not available.

Now, maybe it's possible to do a context handler type object with a
server.transfer from the popup page and do a findcontrol for the original
pages' textbox control that the calendar value needs to update but I think
that would just change the calendar popup from a calendar to a 2nd rendition
of the original page.

You can call a static class but that class will last be called by the popup.
If that static class could see the textbox control then maybe but I'm not
sure how to do that.

Ideally I'd like the popup page closed after a selection and the original
page updated.

Thanks for the response.

"Mark Fitzpatrick" wrote:

> Why do you need to have it post it's data to a page? Why not encapsulate the
> logic into a class or function that can be called anywhere? All you need to
> do is when the calendar post back, have it pass information to a class or
> static method that does what you need. If you are doing something like
> selecting a date so that you can then pull up a list of events that occur on
> that date, just post back, grab the value, and then redirect to the page
> with the information passed in the querystring. You don't need to do
> anything fancy to make the querystring, it's just plain text value pairs.
>
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - Expression
>
>
> "segue" wrote in message
> @microsoft.com...
> >
> > I'm trying to get an aspx popup calendar control to post its date value to
> > an asp.net aspx page in the same project. I thought that maybe I could
> > set
> > a property but the scope of the calendar popup ends on that popup page so
> > now
> > in asp.net/vb.net I think I need to do an httpwebrequest from the popup
> > aspx
> > page and post or send the data via http to the target page codebehind and
> > listen for it as a querystring?
> >
> > Also I'm not sure what I need to import in order to see httpwebrequest as
> > an
> > object let alone how to write the syntax in vb.net.
> >
> > ?
> > _
> > Public Class HttpWebRequest _
> > Inherits WebRequest _
> > Implements ISerializable
> >
> > Much thanks and I apologize for the ignorance I know that I'm missing
> > quite
> > a bit here (probably taking the wrong approach).
> >
> >
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
httpwebrequest As best I can figure this should return me something from the host but it hangs on RESPONSE = Any ideas? Private Sub sender As ByVal e As Handles Button1.Click Dim REQUEST As Net.H

HttpWebRequest using Certificates Hi everybody, my VB.NET (Framework 2.0) client application has to do a (for reading web-pages and downloading files) on a web server. The server uses a self-signed certifiacte and the client application should also use a self-signed certifi

System.Net.HttpWebRequest in C++ I added this sample code to my program: string lcUrl = // *** Establish the request loHttp = I am getting the following error: error C2065:

HttpWebRequest POST with headers and DATA in same network pa I’m making a class to POST something on a web page that needs the headers and data to be in the same package. I have tried the following but nothing helps(I always get a packet with headers and one with data).

reading 8BIT chars from old DOS file Hi ! I want to load an old where records stand in. When i view the file in a HEX-Editor it's clear how to acces these Strings and chars in that file. Since these are old 8BIT chars (C# uses 16BIT) i read the file bytewise and convert the b
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group