httpwebrequest vb.net

Discussion in 'ASP .Net' started by segue, Jan 30, 2008.

  1. segue

    segue Guest

    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).
    segue, Jan 30, 2008
    #1
    1. Advertising

  2. 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:...
    >
    > 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).
    >
    >
    Mark Fitzpatrick, Jan 30, 2008
    #2
    1. Advertising

  3. segue

    Guest

    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
    >
    > news:...
    >
    >
    >
    >
    >
    > > 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 -
    , Jan 30, 2008
    #3
  4. segue

    segue Guest

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

    >
    segue, Jan 30, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Oct 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,385
    Feroze [msft]
    Oct 22, 2004
  2. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Oct 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    449
    Greg Reevosh via .NET 247
    Oct 31, 2004
  3. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Nov 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    576
    Feroze [msft]
    Nov 19, 2004
  4. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Dec 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    446
    Greg Reevosh via .NET 247
    Dec 22, 2004
  5. Ken Fine
    Replies:
    2
    Views:
    584
    Steven Cheng
    Sep 17, 2008
Loading...

Share This Page