httpwebrequest vb.net

httpwebrequest vb.net

am 30.01.2008 03:25:02 von segue

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).

Re: httpwebrequest vb.net

am 30.01.2008 04:09:45 von Mark Fitzpatrick

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
news:7C853389-580A-4CCD-921B-CA2A8041C04B@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).
>
>

Re: httpwebrequest vb.net

am 30.01.2008 13:43:14 von chike_oji

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 =3D String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ViewState["dtDate"] =3D dtDate;
}
else
{
dtData =3D (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"] =3D dtDate;

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

I hope this helps.

Regards,

Chike

On Jan 30, 4:09=A0am, "Mark Fitzpatrick" wrote:
> Why do you need to have it post it's data to a page? Why not encapsulate t=
he
> logic into a class or function that can be called anywhere? All you need t=
o
> 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
>
> news:7C853389-580A-4CCD-921B-CA2A8041C04B@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. =A0I thought that maybe I coul=
d
> > set
> > a property but the scope of the calendar popup ends on that popup page s=
o
> > now
> > in asp.net/vb.net I think I need to do an httpwebrequest from the popup
> > aspx
> > page =A0and 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 a=
s
> > an
> > object let alone how to write the syntax in vb.net.
>
> > ?
> > _
> > Public Class HttpWebRequest _
> > =A0 =A0Inherits WebRequest _
> > =A0 =A0Implements 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 -

Re: httpwebrequest vb.net

am 30.01.2008 21:29:01 von segue

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
> news:7C853389-580A-4CCD-921B-CA2A8041C04B@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).
> >
> >
>