httpwebrequest vb.net

S

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.

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

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

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 = 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
 
S

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top