Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript Server Side ?!?!?!? 2

Status
Not open for further replies.

ASPVB

Programmer
Jul 27, 2002
32
US
Hi gays ! Do sombody know why I get error :
BC30081: Block 'If' is missing an 'End If'
I fill it is becouse I try to send to brows. Client-Script like I did in VID . If so how can I write ClientScript from server ? Or what is wrong ?

here is my piece of code :


====================================================
<%@ Page Language=&quot;VB&quot; Debug=true %>
<%@ Import Namespace=&quot;System.Web.UI&quot; %>

<script runat =&quot;server&quot;>
dim firstDbl as double, SecondDbl as double
dim pScript as string ,tmpPage as string
Sub Calculate(sender As Object, e As System.EventArgs)
dim ii as double
firstDbl = val(tbfirst.Text)
SecondDbl = val(tbsecond.Text)
if not check1.checked then
if sender.Text=&quot;Add&quot; then
ii= firstDbl + SecondDbl
elseif sender.Text=&quot;Subtract&quot; then
ii= firstDbl - SecondDbl
elseif sender.Text=&quot;Multiply&quot; then
ii= firstDbl * SecondDbl
elseif sender.Text=&quot;Divide&quot; then
ii= firstDbl / SecondDbl
end if
lblMessage.Text= CStr(ii) + sender.id
else
lblMessage.Text= &quot; Checked bb!!!!!&quot;
response.write (&quot;<script language='javascript'>window.open('hm_DB_to_XML_006.aspx');</script>&quot;)

end if

btadd.style(&quot;Border-Style&quot;)=&quot;notset&quot;
btMultiply.style(&quot;Border-Style&quot;)=&quot;notset&quot;
btDivide.style(&quot;Border-Style&quot;)=&quot;notset&quot;
btSubtract.style(&quot;Border-Style&quot;)=&quot;notset&quot;
sender.style(&quot;Border-Style&quot;)=&quot;inset&quot;
End Sub

</script>

<html><body>
<form runat =&quot;server&quot;>
first value <asp:textbox id=&quot;tbfirst&quot; runat=&quot;server&quot;/> <br>
second value <asp:textbox id=&quot;tbsecond&quot; runat=&quot;server&quot;/> <br>
<asp:CheckBox id=&quot;check1&quot; Text=&quot;Check box &quot; TextAlign=&quot;Right&quot; AutoPostBack=&quot;false&quot; checked=false runat=&quot;server&quot; /><br>
<asp:button id=&quot;btAdd&quot; onClick=&quot;Calculate&quot; Text=&quot;Add&quot; runat=&quot;server&quot;/>
<asp:button id=&quot;btSubtract&quot; onClick=&quot;Calculate&quot; Text=&quot;Subtract&quot; runat=&quot;server&quot;/>
<asp:button id=&quot;btMultiply&quot; onClick=&quot;Calculate&quot; Text=&quot;Multiply&quot; runat=&quot;server&quot;/>
<asp:button id=&quot;btDivide&quot; onClick=&quot;Calculate&quot; Text=&quot;Divide&quot; runat=&quot;server&quot;/> <br>
output value <asp:label id=&quot;lblMessage&quot; font-size=&quot;20pt&quot; runat=&quot;server&quot;/>

</form>
</body></html> ====================================================
appreciated any help !!!!
 
You can take a slightly different approcah creating a client side javascript(C# sample):
Code:
string script = &quot;<script language=javascript>&quot;;
script += &quot;window.open('hm_DB_to_XML_006.aspx');&quot;;
script += &quot;</script>&quot;;
if(!Page.IsClientScriptBlockRegistered(&quot;doPopup&quot;))
{
 Page.RegisterClientScriptBlock(&quot;doPopup&quot;, script);
}
See if this'll help.
 
No Men !
It still same error ...
 
Does the error occur during compilation or run time? Try to play with your IF statement inside Calculate sub; comment out everything inside of it, then uncomment line by line to see which one causes an error.
 
Hi LV !
Thanks for care !!!

It is appear by compilation when at least on of the next rows exsist :

pScript = &quot;<script language=javascript>window.open('hm_DB_to_XML_006.aspx');</script>&quot;
if not Page.IsClientScriptBlockRegistered(&quot;doPopup&quot;) Page.RegisterClientScriptBlock(&quot;doPopup&quot;, pScript)

What intresting error come up even I comment these lines,
the only one thing help -> removing them (but I need it exacly in this sub) !!!

Thanks again !
 
Try to substitute '(single quote) with &quot;&quot;(two double quotes):
Code:
pScript = &quot;<script language=javascript>window.open(&quot;&quot;hm_DB_to_XML_006.aspx&quot;&quot;);</script>&quot;
 
NO ! does not help ! It killing me !
 
Huh...Hard for me to say, I have similar code all over(in C#) and no problems so far. I would ry to substitute the inner IF with the Select Case, see if it'll do any good
 
O my God !
It funny ! now it change for :
BC30095: A 'Select Case' must be paired with an 'End Select'.
 
Does it highlight any words in
Code:
&quot;<script language=javascript>window.open(&quot;&quot;hm_DB_to_XML_006.aspx&quot;&quot;);</script>&quot;
as if it were a keyword?
 
O now it's make sence ! You are working in Visual Studio.Net
and I'm from in 1-st beta version , I even do not have debbager !!! I see errors when I run .aspx page from
IIS/right_click/browse !!
I have to install whole .NET


Thanks LV !!!!!!!!!!!!!!!!!!
 
OK, I see. Let me know how it turns out.
 
Hi LV !

Men thanks for cooperation !
Your advise was help me a lot !!!!!!!

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top