Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > httpwebrequest vb.net

Reply
Thread Tools

httpwebrequest vb.net

 
 
segue
Guest
Posts: n/a
 
      01-30-2008

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.

?
<SerializableAttribute> _
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).


 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      01-30-2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.
>
> ?
> <SerializableAttribute> _
> 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).
>
>


 
Reply With Quote
 
 
 
 
chike_oji@yahoo.com
Guest
Posts: n/a
 
      01-30-2008
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" <(E-Mail Removed)> 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" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
>
>
> > 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.

>
> > ?
> > <SerializableAttribute> _
> > 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 -


 
Reply With Quote
 
segue
Guest
Posts: n/a
 
      01-30-2008

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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > 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.
> >
> > ?
> > <SerializableAttribute> _
> > 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).
> >
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with System.Net.HttpWebRequest Greg Reevosh via .NET 247 ASP .Net 1 11-19-2004 11:26 PM
HttpWebRequest problem: Please help Sojwal ASP .Net 1 11-10-2004 09:00 PM
Issue with System.Net.HttpWebRequest Greg Reevosh via .NET 247 ASP .Net 0 10-31-2004 11:48 AM
Issue with System.Net.HttpWebRequest Greg Reevosh via .NET 247 ASP .Net 1 10-22-2004 06:21 PM
HttpWebResponse/HttpWebRequest problem... Satinderpal Singh ASP .Net 2 06-04-2004 04:40 AM



Advertisments