Forum Moderators: open
<script type="text/javascript">
function reSort(flag) {
var frm = document.forms[0];
frm.action = "reportOrg.aspx?sort=" + flag;
frm.submit();
}
</script>
...
<td><a href="#" onclick="reSort('event')">Event</a></td>
ASP.NET should then look for "sort" in the querystring and store its value:
sortOrd = request.queryString("sort")
if sortOrd = "" then
sortOrd = "name"
end if
When the form is submitted normally (with its Submit button) it fills the table with data, and the values submitted stay in the form. But when I press my re-sort links, two things go wrong. First, the form is blank, even though it's full of data when the JavaScript submits it. (There's no data in the table, either.) Second, I get this weird queryString:
[example.com...]
What am I doing wrong?
I do it the same kind of way, but without javascript.
I just use a href links and include the sort code in the link.
href=thispage.asp?s=N
or
hred=thispage.asp?s=A
to sort by number or Alpha.
Then my query looks like this (in jscript):
sql = "select fields from table where conditions ";
if (Request("s") == "N" ¦¦ String(Request("s")) == "undefined") {
sql += " order by name";
} else {
sql += "order by number"
}
Does that make sense?
<added>Oh, a little more information that may be useful: the form's method is POST, not GET, which is why the queryString from the first post is so weird - the only thing in the queryString should be "sort". Sorry I'm explaining this so badly...</added>