Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

vb.net pass querystring to asp:textbox

Hello All;

I found out that I cannot do something like this.
Cannot have a codeblock in the asp tag.
<asp:TextBox ID="email" runat="server"><%=Request.QueryString("email") %></asp:TextBox>

Open in new window


I can do it old school.
(But this causes the following error:
 Invalid postback or callback argument.)
<input type="text" ID="email" name="email" readonly value="<%=Request.QueryString("email") %>" />

Open in new window


So, what to do?
How can I pass the querystring value to the field, without causing an error, and get the data, to finish processing the form?
I read that I could do an Eventhandler, however. I have no idea on where to even start on that one.

Thanks All
Carrzkiss
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes you can but probably you need to do it via code behind in form load event instead
yea, it should be page load instead of form load : )
btw, your scripts posted should work well.

<script runat="server">
    Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs) Handles Me.Load
        Myemail.Text = Request.QueryString("email")
    End Sub
</script>

Open in new window

Avatar of Wayne Barron

ASKER

I found the code from an asp.net forum to use.
Easy to implement and works like a charm.

Wayne