[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

(Adam)

9/18/2002 7:39:00 PM

Hi all,
I am using the MMIT to develop a mobile app. I have a textbox and a
command button in the page that I want to use for searching. For
code, I have:

Private Sub cmdFind_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmdFind.Click
Dim strCriteria As String

strCriteria = HttpUtility.UrlEncode(txtProject.Text)

RedirectToMobilePage("FindProject.aspx?Criteria=" &
strCriteria)
End Sub

Assume textbox txtProject and command cmdFind.

This works fine like this. However, if I set the value of the textbox
in the Page_Load Event, when I click on cmdFind, I do not get the
current value of the textbox, but rather, the initial value that I set
it to.

For example,
- txtProject.Text = "Foo" initializes the textbox with "Foo"
- I type "Bar" in the textbox
- The resulting redirect is FindProject.aspx?Criteria=Foo

Any ideas?

Cheers,
Adam
1 Answer

Frank Tse [MS]

9/18/2002 8:56:00 PM

0

During the page cycle the setting of the postback textbox value is done
before Page_Load. So if you set value in the Page_Load event, that will
override the value that is set from the postback data.

Is there any particular reason why you want to initialize the textbox value
in Page_Load but not declaratively in the page itself or in Page_Init event?

--
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.asp.n...


"Adam" <apkehler@hotmail.com> wrote in message
news:1d058ad1.0209180934.38081119@posting.google.com...
> Hi all,
> I am using the MMIT to develop a mobile app. I have a textbox and a
> command button in the page that I want to use for searching. For
> code, I have:
>
> Private Sub cmdFind_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles cmdFind.Click
> Dim strCriteria As String
>
> strCriteria = HttpUtility.UrlEncode(txtProject.Text)
>
> RedirectToMobilePage("FindProject.aspx?Criteria=" &
> strCriteria)
> End Sub
>
> Assume textbox txtProject and command cmdFind.
>
> This works fine like this. However, if I set the value of the textbox
> in the Page_Load Event, when I click on cmdFind, I do not get the
> current value of the textbox, but rather, the initial value that I set
> it to.
>
> For example,
> - txtProject.Text = "Foo" initializes the textbox with "Foo"
> - I type "Bar" in the textbox
> - The resulting redirect is FindProject.aspx?Criteria=Foo
>
> Any ideas?
>
> Cheers,
> Adam