question about postback

M

Mark

Hi,

In the aspx file, the form is submitted with a javascript like this:

<form id="ins" method="post">
<input id="sql" name="sql" type="hidden" />
<input runat="server" id="Submit1" type="button" value="click"
onclick="myfunc()"/>
</form>

<script language="javascript" type="text/javascript">
function myfunc()
{
document.getElementById("sql").value=inscomm
document.getElementById("ins").submit()
return true;
}
</script>

In the code-behind page, i did this (which doesn't work):
--------------------------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim sqlcomm As String
sqlcomm = Request.Form("sql")

If page.IsPostBack
response.write("ok")
else
....

I can solve this by doing this (which works):
-------------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim sqlcomm As String
sqlcomm = Request.Form("sql")

If sqlcomm <> "" Then
response.write("ok")
else
....

My question: why is this not considered as a postback?
Thanks
Marc
 
M

Mark Rae [MVP]

My question: why is this not considered as a postback?

Because it isn't...

What you have here is a bog-standard HTML form...

For a postback in ASP.NET, you need an ASP.NET form...
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top