|
-
May 2nd, 2001, 02:09 PM
#1
Thread Starter
Lively Member
VB Script Question
Hi all,
I'm new to Asp page. I have an Asp page which displays the results of a query from SQL server. This works good. The data I'm displaying is in a table format.
What I want to do, is to have a command button at the end of each row. So when the user clicks on the button a different asp page should open up with text boxes where I could change or add value, and then save it to the database (in SQL Server).
How do I create the command button, so that it is linked to a particular row, and when the values are changed/added how does it update that particular row.
I hope I'm explaning myself clearly.
Thanks,
Reggie
-
May 2nd, 2001, 02:22 PM
#2
Frenzied Member
Reggie,
You are explaining yourself just fine. It is a very involved kind of answer, though.
I would probably put a little bit of JavaScript on the page and anchors instead of form submit buttons. Let me show you.
Code:
<%Randomize%>
<form name='Update' method='POST' action='NextPage.asp'>
<%
'ASP Example
'Do SQL Query here and parse data like you want
'Step through each row of the SQL data and put it in the table
'Write this as the last data element
Response.Write("<a href='JavaScript:UpdateRow(\"" & i & "\");>Update</a>");
'Do this were i is the current row that may need to be updated.
%>
<input type='hidden' name='whichRow'>
</form>
<script language='JavaScript>
function UpdateRow ( RowNum ) {
document.Update.whichRow.value = RowNum
document.Update.submit();
}
<script>
Anyway... I'm sure there is a solution that doesn't involve bringing in another technology (JavaScript), but it is a very quick and easy one.
Anyway, on the next page you can ask what Request.Form("whichRow") is.
Another solution would be to create different submit buttons for each row, but that can be cumbersome.
I hope I made sense.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 2nd, 2001, 02:32 PM
#3
Frenzied Member
'Course, it dawns on me that you don't have to use JavaScript as your client side script language. In theory you can use VBScript, but I'm not sure if any browser other than IE supports it. Oh... yeah, you can use JScript, but what's the point of mentioning that.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 2nd, 2001, 05:12 PM
#4
Frenzied Member
Another option is to put a form on each line with a submit on each line and put the record's id value into a hidden textbox. You can do this in a loop and all the forms and submit buttons can have the same name. ASP will keep track of which one was clicked by where it is (Which form tag it falls between).
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
May 2nd, 2001, 05:51 PM
#5
PowerPoster
Originally posted by CiberTHuG
...I'm not sure if any browser other than IE supports it
unfortunatly, nothing else at the moment does...
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
May 3rd, 2001, 07:35 AM
#6
Thread Starter
Lively Member
Thanks you all
I'm going to try and let you all know how it works.
-
May 3rd, 2001, 08:24 AM
#7
Frenzied Member
Originally posted by sail3005
unfortunatly, nothing else at the moment does
Unfortunately? I'd have to disagree. It would be a good thing when VBScript (and JScript) are depreciated. They don't add anything to client-side scripting technology, I'm sure they slow down standardization efforts, and they make browsers larger because they have to maintain client-side engines to parse the different languages.
But anyway....
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 3rd, 2001, 06:53 PM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|