Call two script block's

R

ruca

Hi,

Can I call two script blocks for different languages in my ASP.NET code?

I have a button than when clicked it must open a popup window to return some
values for two other controls that I have in my page. This is no problem.
The problem is that depending of return value I must fill a DropDownList
with different values.

For that I was trying to do this:

****************************BEGIN CODE************************************
Function Test() As Boolean
lblMsg.Text = "Test"
Return True
End Function

Private Sub ibtnVldHrr_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibtnVldHrr.Click
//This is the block that calls a popup that the returns values
that I need

sbScript.Append(Environment.NewLine)
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("pickSearch('" & strUrl &
"','lblIdHrr','edHorario','lblDsHorario');")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterStartupScript("OpenTp", sbScript.ToString())

//This is the block where I want to call a function to fill my
DropDownList
//note that script is runat=server

sbScriptVB.Append("<script Language='VB' runat='Server'>")
sbScriptVB.Append(Environment.NewLine)
sbScriptVB.Append("Dim x As Boolean = Teste()")
sbScriptVB.Append(Environment.NewLine)
sbScriptVB.Append("</script>")
RegisterStartupScript("OpenVB", sbScriptVB.ToString())
End Sub

****************************END CODE************************************

Can anyone help me? Or any sugestions to do something like this?
Thank's a lot
 
S

Scott Allen

Hi ruca:

I wouldn't open two popup windows simaltaneously like this - I think
it would just confused and/or annoy the user.

Perhaps what you could build is a wizard like navigation that guides
the users through Step 1 .. N, building controls and asking questions
on each page of the wizard.
 
R

ruca

Hi Scott,

You miss understood the question. I don't want to open two popup windows.
I want to open one popup window that will retrieve a value for my main Web
Form, then what I want is to run a VB function (of main window) when popup's
close. I want this because depending of returned value I must fill a
DropDownList with different values.

Thank's anyway.
 
C

Cor Ligthert

Ruca,

I saw this yesterday already, however Scott answered you already.

My question (and I assume not alone from me) to you is why should that be
JavaScript and VBScript and why not just two separated JavaScript functions?

Cor
 
S

Scott Allen

I apologize, ruca.

Instead of a popup - could you use a Panel control on the web form?
The panel control could have the Visible property set False until you
need input from the user. At the time you need input the panel could
appear visible, and then post back to the webform when the user clicks
a button or fiddles with some other type of input control.

Since all the logic will be inside of a single form it will make for
an easier effort.
 
R

ruca

Hi Cor,

because, like I said before, I must call a function that is present in vb
code that will fill a dropdownlist with data.
Can I call a VB function in javascript?

Like I said before too, I accept sugestions...
 
C

Cor Ligthert

Ruca,
Can I call a VB function in javascript?

I have never used client side VBScript and therefore as well not mixed up,
however why do you not try it?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top