?
Solved

Asp code

Posted on 2012-08-14
10
Medium Priority
?
402 Views
Last Modified: 2012-08-15
What is wrong in this code

<% If User  =  "Kiran" Then %>
  <p>kiran</p>

 <% Else %>

    <p>Not kiran</p>
<% End If %>
0
Comment
Question by:sonawanekiran
10 Comments
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 664 total points
ID: 38291400
try this,
<% 
Dim User
If User = "Kiran" Then 
		response.Write("<p>kiran</p>");

	Else
			response.Write("<p>Not kiran</p>");
    
 End If %>

Open in new window

0
 
LVL 17

Author Comment

by:sonawanekiran
ID: 38291489
Thanks for quick response. Last doubt what if I need include the file

<%
Dim User
If User = "Kiran" Then
%>
  <!-- #include file="admin.inc" -->
<%
      Else

%>
                   <!-- #include file="user.inc" -->
<%    
 End If
%>

is above correct
0
 
LVL 17

Author Comment

by:sonawanekiran
ID: 38291511
Guys suggest..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 38291539
it should work,
<% 
    if Request.QueryString("param")="2" then 
%> 
        <!--#include file="2.htm"--> 
<% 
    else 
%> 
        <!--#include file="1.htm"--> 
<% 
    end if 
%>

Open in new window

0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 38291544
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38292031
Nothing looks wrong with the code as is.  What is the problem you are having?
0
 
LVL 31

Assisted Solution

by:Wayne Barron
Wayne Barron earned 668 total points
ID: 38293362
The code that you originally was using, is OK.
Using an INCLUDE in the middle, is fine.

Doing response,write, is not always a good thing to do, only use it in places that it is needed, other than that, you do not have to do Response.write, as it makes for harder to design layouts.

Carrzkiss
0
 
LVL 18

Expert Comment

by:nap0leon
ID: 38296253

What is wrong in this code

<% If User  =  "Kiran" Then %>
  <p>kiran</p>

 <% Else %>

    <p>Not kiran</p>
<% End If %>

If "User" is defined, there is nothing wrong with the code.
Where you have "<p>kiran</p>" and "<p>Not kiran</p>", you can put whatever you want.  (HTML, more ASP code, etc.)
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 668 total points
ID: 38297338
this code:
<% 
Dim User
If User = "Kiran" Then 
%>
  <!-- #include file="admin.inc" -->
<%
      Else

%>
                   <!-- #include file="user.inc" -->
<%    
 End If 
%>

Open in new window


will ALWAYS include user.inc because the variable "User" is never assigned a value. you need to assign a value to it first, then check with the IF statement
0
 
LVL 17

Author Closing Comment

by:sonawanekiran
ID: 38299082
Thanks everyone
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question