Current location: Hot Scripts Forums » Programming Languages » ASP » problem in excution of HTML Selection list unsing ASP


problem in excution of HTML Selection list unsing ASP

Reply
  #1 (permalink)  
Old 05-16-06, 11:27 PM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
problem in excution of HTML Selection list unsing ASP

Hi to all!

I have tried following ASP code First to check which title has stored for a perticular member in member details Access database. and accroding to that option value will be selected when a perticular member browse or update his data. in database there are three types of Title: MR., DR. and blank/empty field.

But the problem is when the code find title DR. its displaying full data properly, but in the time of DR. title its excute If part as well as Else part together, so both value is displaying on the member details page.

on the other hand if I, put a another if claus to find out blank or empty value, that clause just not working.

here is the code:

Code:
<tr> 
 <td width="250" height="11" bgcolor="#FFFFFF"> 
<div align="right"><font size="1" color="#005CB9"><strong><font face="Verdana, Arial, Helvetica, sans-serif">First Name:</font></strong></font></div></td>
<td height="11" bgcolor="#FFFFFF"> <div align="left"><font color="#666666"><b><font size="1"><strong><font face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="fname" value="<%=rs("F_NAME")%>"></font></strong></font></b></font></div>
</td>
</tr>

<tr> 
<td width="250" height="11" bgcolor="#FFFFFF">
<div align="right"><font size="1" color="#005CB9"><strong><font face="Verdana, Arial, Helvetica, sans-serif">Title: </font></strong></font></div></TD>
<td height="11" bgcolor="#FFFFFF"> <div align="left"><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<% 
sqlstr="select * from XXXX where MNO='" & t & "'"
Set rs=objConn.execute(sqlstr)
dt=rs("TITLE")%>

<%if rs("TITLE")="MR." then%>
<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR." selected>MR.</option>
<option value="DR.">DR.</option> 
<%end if%>

<% if rs("TITLE")="DR." then%>
<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR.">MR.</option>
<option value="DR." selected>DR.</option> 

<%else%>

<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR." selected>MR.</option>
<option value="DR.">DR.</option> 
   		 
<%end if%>
</select> </font></div></td> </tr>

 <tr> 
<td bgcolor="#FFFFFF"> <div align="right"><font size="1" color="#005CB9"><strong><font face="Verdana, Arial, Helvetica, sans-serif">Date of Birth:</font></strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="left"><font color="#666666"><b><font size="1"><strong><font face="Verdana, Arial, Helvetica, sans-serif"><input type="text" name="dob" value="<%=rs("DOB")%>">
</font></strong></font></b></font></div>
</td>
</tr>
if the tried the following one also to find out empty value, but this porsion is only not working:

Code:
<% 
sqlstr="select * from XXXX where MNO='" & t & "'"
Set rs=objConn.execute(sqlstr)
dt=rs("TITLE")%>

<%if rs("TITLE")="MR." then%>
<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR." selected>MR.</option>
<option value="DR.">DR.</option> 
<%end if%>

<% if rs("TITLE")="DR." then%>
<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR.">MR.</option>
<option value="DR." selected>DR.</option> 

<%end if%>

<% if rs("TITLE")="" then%>

<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR." selected>MR.</option>
<option value="DR.">DR.</option> 
   		 
<%end if%>
if any one can find out what mistake i have made, please help me.

i have used same code patter for anothe selection list for 'Prefered Mailing Address' into this same ASP script, there are 3 IF caluses and last one Else. but its working perfectly for all 4 condition.

But it is not working in Title field. in Access database both filed property is same.
Reply With Quote
  #2 (permalink)  
Old 05-17-06, 07:23 AM
koncept
Guest
 
Posts: n/a
what i do for these is use four separate if statments or how ever many is needed like this

Code:
<select name="title" size="1" style="font:Courier New; font-size:12px; color:#0000CC; background-color:#FFFFCC; font-weight:bold;">
<option value="MR." <%if rs("TITLE")="MR." then%>
selected<% end if%>>MR.</option>
<option value="DR." <%if rs("TITLE")="DR." then%>
selected<% end if%>
>DR.</option>
Reply With Quote
  #3 (permalink)  
Old 05-17-06, 11:59 PM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Koncept!

Problem is solved with such compact code.

Thanks buddy!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
ASP help for validation of HTML form with javascript dhanashree ASP 2 03-22-06 01:28 PM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 03:47 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.