469,322 Members | 1,603 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

if condition in asp

hi,
i facing a problem in asp

the code goes like this
thereare two different database.
i have to add multple combo in the page only if my one condition is true.

eg
Expand|Select|Wrap|Line Numbers
  1. var RepName;
  2.  
  3. RepName = "<%=ReportName%>"
  4.  
  5. <%
  6.  Set conn = Server.CreateObject("ADODB.Connection") 
  7.  conn.Open "'
  8.  Set rs = ""
  9.  
  10. If reportname = "ABC" then
  11.  
  12. %>
  13.  
  14. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  15.  
  16. <tr>
  17.     <td class="filterCol1" width="27%">
  18.     <b>Select Agency  : </b></td> 
  19.     <td class="filterCol2" width="73%">    
  20.         <Select name = "xyz" multiple ="true">
  21.         <option value= "all" selected="yes">Select All</option>
  22. <%
  23.  
  24. Do while not rs.eof
  25. name = rs("name")
  26. %>
  27.  <option value="<%= name %>"></option>
  28. <%
  29.  rs.MoveNext
  30. loop
  31. rs.close
  32. set rs=nothing
  33. %>
  34.  
  35. </select>
  36.     </td>
  37. </tr>
  38. </table>
  39. <% End if%>

if i remove if condition then it is working fine, but when i insert if nothing is display
when i debug the code the condition is true than to the table with combo is not displayed.
is there any problem in if statement
Oct 26 '07 #1
6 3544
jhardman
3,406 Expert 2GB
I don't see any problems. for troubleshooting you can add an else clause
Expand|Select|Wrap|Line Numbers
  1. else
  2.    response.write "reportName: " & reportName & "<br>" & vbNewLine
  3. end if
What does this give you?

I would advise to keep capitalization consistant. Even though vbScript is not case sensitive I think it helps (you refer to both "reportname" and "ReportName") but I don't think that will make any difference.

Let me know if this helps.

Jared
Oct 26 '07 #2
thanks for reply the problem has been resolved as the variable name was incorrect.

Well, i am facind one more problem can one page can have multple forms
and how to read that multple forms elements(combo)?
Oct 29 '07 #3
jhardman
3,406 Expert 2GB
Yes, a page can have multiple forms, but as far as I know there is no way to submit more than one form at a time. Tell me what you are trying and maybe I can suggest an alternative.

Jared
Oct 29 '07 #4
hi,
There are two forms in my asp page. one is having multiple elements like single combo, date etc. and other is having multple combo. On click of the submit button the all the value of both the forms pass to one page.
problem is that values of first forms are passed easily but other form which is having multple combo is not passed.
can you please help me? It's very urgent.
Oct 31 '07 #5
jhardman
3,406 Expert 2GB
hi,
There are two forms in my asp page. one is having multiple elements like single combo, date etc. and other is having multple combo. On click of the submit button the all the value of both the forms pass to one page.
problem is that values of first forms are passed easily but other form which is having multple combo is not passed.
can you please help me? It's very urgent.
why can't you put them all in one form?

Jared
Oct 31 '07 #6
markrawlingson
346 Expert 100+
As Jared said, there is no way to submit two forms at one time, only one or the other. The information from the other form isn't being lost - it's just not being sent.

What that means, essentially, is that if you have two forms on your page - a submit button will only submit the information in its parent form, the other information will NOT be passed to asp in the Request.Form object and therefore you can't access it on the next page.

It would be like a University professor giving out 2 assignments. The next day I submit only 1 assignment - He hasn't received the other assignment so he can't mark me on it because i didn't submit it.

If you want the information in both forms to be accessible on the second page, you will need to have 1 form, not 2.

Sincerely,
Mark
Oct 31 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Kendal Goodrich | last post: by
3 posts views Thread by Ben R. | last post: by
3 posts views Thread by Yohan | last post: by
4 posts views Thread by joh12005 | last post: by
3 posts views Thread by jm.suresh | last post: by
reply views Thread by RN1 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.