Whing Dela Cruz
asked on
If condition on Html with Asp
Hi experts, How to write a condition on Html with Asp session? As code shown below with an aim that if the Session is empty then the Session will have its new value as "Big E".
<script>
if '<%= Session("Allow")%>' == "" then
<%Session("Allow")="Big E"%>
end if
<script>
<script>
if '<%= Session("Allow")%>' == "" then
<%Session("Allow")="Big E"%>
end if
<script>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Add a control such as someLabel, a label
<%
If Session("Allow") = "" Then
Session("Allow") = "Big E"
else
someLabel.Text = Session("Allow")
End If
%>
ASKER
Hi Shaun, you told "someLabel.Text" I wanted to put the value of "Allow in here" <input type="text" id="myCode"> How should I write the code?
<%
If Session("Allow") = "" Then
Session("Allow") = "Big E"
else
myCode.Text = Session("Allow")
End If
%>
ASKER
Hi, Shaun, I'm getting error, Error Type: Microsoft VbScript runtime. Object required: 'myCode'
Textbox should be server-side
<asp:textbox runat="server" id="myCode" ></asp:textbox>
ASKER
Hi Shaun, Please understand that I am very beginner of ASP and Html. So, I do not know where to write this, <asp:textbox runat="server" id="myCode" ></asp:textbox>
Inside the aspx page
ASKER
Hi Shaun, My concern was answered correctly by you both and I really appreciated for that. The second concern is remain unsettled but i decided to close this question since I need to re-align my codes that might possibly lead me to the answer of . Thank you, for your participation. More power to both of you and God Bless!
ASKER
<%
If Session("Allow") = "" Then
Session("Allow") = "Big E"
else
document.getElementById("m
End If
%>