[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

What is the equivalent client-side Java-Script for this server-side script ?

Posted on 2006-06-09
13
Medium Priority
?
338 Views
Last Modified: 2013-11-18
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim DynamicVar As Integer
DynamicVar = //Dynamically generated value when this button clicked  --- WHEN BUTTON CLICKED (REMEMBER)

Dim sb As New StringBuilder
sb.Append("<script language=javascript>")
sb.Append("window.open('")
sb.Append(DynamicVar)   //Note that the Dynamically generated value is passed as a parameter here and opens a new window at the same time.
sb.Append("','mywin';")
sb.Append("</script>")

Response.Write(sb.ToString())

End Sub

I need client-side Java-Script for this. (function on the client-side where i can pass the dynamica value and opens a new window when button clicked).

Thanks,
Kishore
0
Comment
Question by:kishore_peddi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
13 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16875448
you mean something like this?
<script type="text/javascript>
var newwindow;
function OpenIT(url)
{
      newwindow=window.open(url,'name','height=400,width=200');
      if (window.focus) {newwindow.focus()}
}
</script>
You pass the url variable to the function to open the window?
use it like this
<a href="javascript:OpenIT('mypage.aspx);">Open mypage.aspx</a>

if this is not what you looking for, can you explain what you want to achieve ?
0
 

Author Comment

by:kishore_peddi
ID: 16875638

<a href="javascript:OpenIT('mypage.aspx);">Open mypage.aspx</a>

There is no hyperlink where user can click. This should happen when the button click was done.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
//The value is dynamically generated here. Now i want to pass this value to JavaScript function.
//OpenIT in your example
End Sub

But you can say, i can write like this in page_load (event)

Button1.Attributes.Add("OnClick", "OpenIT(" & duynamicvar & ")");

But you can't do this also, becuase the value when you are binding will be nothing if you have done in page_load event.

Got it ?

Thanks,
Kishore
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16875655
where do you expect the "dynamic" value to come from?
as I said in my previous post, can you provide more details about your requirement

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kishore_peddi
ID: 16875723


I will get the dynamic value from database. So i want to pass that value to JavaScript function when the button clicked.

When the button clicked the following things will happen

1. Get the dynamic value from database.
2. Pass that value to the JavaScript function.
3. Invoke the window.open method to open a new window in JavaScript.
4. Pass the dynamic value to the newly opened window as a query string.

Is this insight is enough ?

Thanks,
Kishore
0
 
LVL 12

Accepted Solution

by:
deanvanrooyen earned 2000 total points
ID: 16875728
default.cs

...
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenWindow("Hello there!!!!");
    }

    protected void OpenWindow(string var)
    {
        Button1.Attributes.Add("onclick", "window.open('default2.aspx?a=" + var + "',null,'left=400, top=100, height=250, width= 250, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');");
    }
...

default2.cs
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Label1.Text = Request.QueryString["a"].ToString();
    }
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16875748
what deanvanrooyen has provided you seems like a good solution for your requirement
0
 

Author Comment

by:kishore_peddi
ID: 16875781

But

protected void Page_Load(object sender, EventArgs e)
{
        OpenWindow("Hello there!!!!");   //This is a static value and you are not getting from database.
}

But my dynamic value comes from database when the button clicked.

Thanks,
Kishore
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16875810
when the button is clicked it postback to the server to get the data then reload the page with the new or updated  data
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 16876391
OpenWindow("Hello there!!!!");


"Hello there!!!!" is merely an example -  you can put anyhting in its place - the reason was to show you that the string to transfered var which is added to the query string.

You can also transfer the data from page to page now in 2.0
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 17070447
hopefully this is solved
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question