|
|
| Seth Meranda 2005-02-25, 6:27 pm |
| I am trying to write a bit a code that will display certain elements if
the proper authorization level is true. How do I write ASP code inside a
Response.Write tag?
This is what I have, but I get an error because of the '%>' tag after
rs_list.Fields.Item('ID').Value:
<% If Session("MM_UserAuthorization") = "guru,admin" Then
Response.Write("<A href='editproperty.asp?<%= MM_keepNone &
MM_joinChar(MM_keepNone) & 'ID=' & rs_list.Fields.Item('ID').Value
%>'>edit</A> <A href='deleteproperty.asp?<%= MM_keepNone &
MM_joinChar(MM_keepNone) & 'ID=' & rs_list.Fields.Item('ID').Value
%>'>delete</A>")
End If %>
This is the error I get:
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/training/dbdictionary/details.asp, line 371
Response.Write("<A href='ditproperty.asp?<%= MM_keepNone &
MM_joinChar(MM_keepNone) & 'ID=' & rs_list.Fields.Item('ID').Value
-----------------------------------------------------------------------------------------------------------------------------^
--
Seth Meranda
smeranda2<at>unl<dot>edu
| |
| danilocelic *TMM* 2005-02-26, 4:15 am |
| Seth Meranda wrote:
> I am trying to write a bit a code that will display certain elements if
> the proper authorization level is true. How do I write ASP code inside a
> Response.Write tag?
>
> This is what I have, but I get an error because of the '%>' tag after
> rs_list.Fields.Item('ID').Value:
You're placing the ASP delimiters <% %> with a string, that dosen't make them work, that jsut makes them part fo the string.
You can concatenate ASP code with strings by doing something similar to the following:
Response.Write("my string" & ASP_variable & " more string here")
Make sense?
--
Danilo Celic
| Extending Knowledge Daily : http://CommunityMX.com/
| Team Macromedia for Dreamweaver : http://macromedia.com/go/team/
| |
| Seth Meranda 2005-02-26, 4:15 am |
| So with the code I put in my previous message, how do I do this? I am
not quite sure what you mean.
<% If Session("MM_UserAuthorization") = "admin" Then
Response.Write("<A href='editproperty.asp?<%=
MM_keepNone & MM_joinChar(MM_keepNone) & 'ID=' &
rs_list.Fields.Item('ID').Value %>'>edit</A> <A
href='deleteproperty.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) &
'ID=' & rs_list.Fields.Item('ID').Value %>'>delete</A>")
End If %>
--
Seth Meranda
smeranda2<at>unl<dot>edu
| |
| danilocelic *TMM* 2005-02-26, 4:15 am |
| Seth Meranda wrote:
Something like this:
Response.Write("<A href='editproperty.asp?" & MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & ....
The ASP delimiters <% and %> are to be used to tell the server that it's entering and exiting ASP code. The code you had, was already within ASP code, so you can't use them again.
--
Danilo Celic
| Extending Knowledge Daily : http://CommunityMX.com/
| Team Macromedia for Dreamweaver : http://macromedia.com/go/team/
| |
| Seth Meranda 2005-02-26, 11:15 pm |
| Where can I find some more information on this topic? Or do you know of
a better way to do this? I understand that I can't have the ASP code
inside the original ASP code, but I don't know how else to accomplish
the same thing.
--
Seth Meranda
smeranda2<at>unl<dot>edu
| |
| Billium99 2005-02-26, 11:17 pm |
| Using Dreamweaver's built in User Authentication behaviors, I've set it up so
that you have access levels 1-4. Then there are elements on certain pages that
I only want to show to say...1 and 2 level, but not 3 and 4. I've attached
sample code that does this. Note that everything between <td> and </td> in the
code is irrelevant. That just happens to be the object I was imposing this
behavior on. HTH Bill
| |
| danilocelic *TMM* 2005-02-27, 6:30 pm |
| Seth Meranda wrote:
> Where can I find some more information on this topic? Or do you know of
> a better way to do this? I understand that I can't have the ASP code
> inside the original ASP code, but I don't know how else to accomplish
> the same thing.
On this topic, do you mean how to adding strings together with variables? Or do you mean ASP in general?
I don't know of any particularily good tutorials on adding string ( called concatenation ) tutorials, as everythign I've seen jsut shows teh adding of a couple of strings and the adding of a couple of variables, such as:
myString = varable1 & " my string " & variable2 & " more string " & variable3
A quick google turns up a couple of these types of examples:
A not so helpful documentation description of it:
http://msdn.microsoft.com/library/d...ncatenation.asp
http://www.functionx.com/vbscript/Lesson03.htm
go about 2/3 the way down and look for String Concatenation
Beyond that, you'll have to take those examples and apply them to your situation. What you are trying to do is to take a value that is in a variable and add it somewhere in a string. Things like MM_keepNone are variables, so you can use them exactly like
I did in my simple example above, as well as in the exmaples I've posted already. If you're not quite getting what I'm doing in this code, then what I'd need you to do is to explain to me what your thinking is at every step of the way in my example, and
I can tehn let you know where you're getting off track.
For ASP in general, one thing to remembe is that ASP can be done in VBscript or Jscript. Most references are for VBScript. I'd suggest getting the info from the source. Windows Script Documentation:
http://msdn.microsoft.com/library/d...oriVBScript.asp
downloadable version:
http://www.microsoft.com/downloads/...&displaylang=en
and maybe a quick read through some of the following:
http://www.sitepoint.com/article/asp-language-basics
--
Danilo Celic
| Extending Knowledge Daily : http://CommunityMX.com/
| Team Macromedia for Dreamweaver : http://macromedia.com/go/team/
| |
| Seth Meranda 2005-02-27, 11:16 pm |
| Thanks for the reply Bill. Unfortuantly I don't see any code attached,
it could be my news reader. Could you put the code in a new reply? You
can also send an attachment to the email address below. Thanks!
--
Seth Meranda
smeranda2<at>unl<dot>edu
| |
| Billium99 2005-02-28, 6:28 pm |
| I seem to be disfunctional when attaching code. Don't know why. I'll email it to you this evening.
Bill
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |