Friday, March 16, 2012

passing a variable to new page

Hello
I am new to asp.net, please help.
I have link and this works fine
Add/Edit

In classic asp I would use

<% Request.form("tbName ") %>

or
<% Request("tbName") %>

Sometimes I would assign this value to a variable and use it anywhere on the page.
How do I do this or is there a better way to do it in .net.
TIA MichaelIn the adim_sCodeEdit.aspx file, you just do the same:

(In the code behind file)

Dim tbName as string = request.params("tbName")

...
And do the test, make sure you capture the right result:

 response.write(tbName)

Thanks for the quick reply le9569
My companies isp does not support code behind.
This is how I have it now and it works. I was not sure where to put the
 response.write(tbName)
to make it work, everyplace I tried gave me errors.
Thanks again


<%@. Page Language="vb" Debug="true" %>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim tbName as string = request.params("tbName")
lbltbName.text = tbName
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="lbltbName" runat="server"></asp:Label>
</form>
</body>
</html>

0 comments:

Post a Comment