Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

One last question and I'll have my old asp page converted:

 

How can I convert the following old asp code? I need to put this logic in my code-behind page.

 

<form name="frmSearch" method="post" action="

<%

if dbCustID = "" then

response.write ("/searchresults.asp")

else response.write ("/searchresults.asp?customerID=" & dbCustID)

end if

%>" onsubmit="return chkSearch(this)">

 

Tried using label and can't get that to work

 

Thanks

Posted

I believe I need to handle it this way:

<form id="frmSearch" runat="server" onsubmit="return chkSearch(this)">

<input type="text" name="keyword" size=14 maxlength=50 value="Search here...">

<input type="image" src="/_images/header_go.gif" border="0" alt="Search"></form>

 

And I added this in my ascx.vb:

If IsPostBack Then

Response.Redirect("/searchresults.asp" + strCustID, True)

End If

 

My problem is that in searchresults.asp I have the following code which will not work since I'm doing a redirect from the ascx.vb:

lvKeyword = trim(request.form("keyword")

 

I don't want to put this value in a querystring. How can I post to searchresult.asp like I did before?

Thanks

  • *Gurus*
Posted
You can't submit (POST) to another page using a server-side form in this version of ASP.NET. Either use a HTML form, which doesn't run on the server-side (e.g. no "runat" attribute), or re-work your code to postback to the same page, as is the intended behavior of the ASP.NET model.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...