java script function in .net function

Dear All,

I’m trying to open up a window with a form in it, but first I need to make sure that the user checked at least one or more item on a list with checkboxes in each row on the page where I push the button to open the window from.

I use the following simple code:

Public Sub btnLog_onClick(ByVal sender As System.Object, ByVal e As System.EventArgs)


        Dim myCsv = getTickedItems(1)

        If myCsv = "" Then

            Exit Sub


            Dim myUrl As String

            Response.Write("<script>'" & myUrl & "','pageRef','width=620,height=400,left=380,top=290');newwindow.focus();</script>")

        End If

    End Sub

The only problem is, the pop up is not focused on and I can’t get it to be focused on. Can someone tell me how to fix this?

4/6/2006 4:11:13 PM 24353 articles. 2 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 53
Get it on Google Play
Get it on Apple App Store

Try using RegisterStartupScript("OpenerScript", "your script goes here") instead of Response.Write


4/6/2006 6:43:29 PM

Thanks for suggestion, but that doesn’t seem to work either.

I put windows.focus() in the pop up, but it's still not great as the pop up appears, disappears, then gets focused on. Bit clumsy

4/7/2006 12:51:20 PM

You might look at this as it's a complete sample using that refreshes the parent window when closed.


4/7/2006 2:07:28 PM


javascript write in aspx page

<script language=javascript>

function OpenPage()

{'" & myUrl & "','pageRef','width=620,height=400,left=380,top=290');




in backend file write this

public dim myUrl As String

Dim myCsv = getTickedItems(1)

        If myCsv = "" Then

            Exit Sub


buttonID.attributes['onclick']="return OpenPage();"         

        End If

    End Sub


Warm Regards,

Impossible Is Nothing
4/11/2006 5:11:19 AM

Which is exactly what is detailed out in the link that I posted, except it shows 2 different ways to open the child -- 1. Before the PostBack (as Jayu posted) and 2. After the PostBack in case you need to do something server-side before opening the window.



4/11/2006 11:42:28 AM

Thanks, I'll have a look at these

Yes I need to check if any and which checkboxes are checked within a dataGrid before I open the pop up as users must not be able to open the pop up unless they have ticked at least item, plus I need the pop up to know the ids of the checkboxes in order for them to be processed on the form on the pop up.

What I have works, only the pop up doesnt get focused on, whihc is very irritating.
4/11/2006 5:05:58 PM

Similar Artilces:

communication between client side(java script) and server side in .net project
I have a question which is, when building a .net project, we are able to use server side code and client side code(java script). How do they communicate? Thanks Client Side coding works with the WebBrowser. So when ever you write client side code you have to keep browser compatability in your mind and you have to code. Server Side code works with Web Server (IIS) and it's ASPNET ISAPI's. The won't directly communicate with each other. But using AJAX you can all server side code from Client Side! Example article on Ajax@

how to call java script function in ?
I have working with grid view and get records from database if the records exceding 1000 then I need to display confirm dialog box through javascript ? if click ok then it will display the records in gridview and if click cancel then it will create a message into label .   want to know where to call java script function on the button that will display this javascript dialog.Basim Hi, try this... //Code to get the datasource dataset ds if(ds.Tables[0].Rows.count > 0) {     Page.ClientScript.RegisterStratUpScript(this.GetType(),"showal","ShowGri...

How to call java script function in file)
Hi, i have written following script in aspx file which works fine:  ----------------------------------------------------------------------------------<script type="text/javascript" language="javascript"> function Enable_ddlyear() {  document.form1.TxtStartDate.disabled=true ; document.form1.TxtEndDate.disabled=true ;var x=document.getElementById("ddlyear") x.disabled=false }  function Enable_dates() {document.form1.TxtStartDate.disabled=false ; document.form1.TxtEndDate.disabled=false ;document.form1.ddlyear.disabled=true ; ...

How to call server side(C#) function from Client side(Javascript) function?
Hi i have used below functions,  function HandleOnClose() {// this function will be called after clicking browsers close button in Internet explorer if (event.clientY < 0) { event.returnValue = 'Are you sure you want to leave the page?'; } // if he clicks ok then i need to call one server side function in this instance.. else not. } <body onbeforeunload="HandleOnClose()" leftmargin="0" rightmargin="0">other controls in page..</div>  How to achieve this? Thanks MS AJAX Extensions would be the option of choice here. Combined with webservices you can...

Need help converting a C#/.NET method into client-side (javascript) function
Hey Guys, I have implemented an AJAX Toolkit CalendarExtender.  I have a method 'CheckDate' in javascript (followed a tut!) that checks to see if the user selected a date > DateTime.Now(). Well, I have a few other things to check but not sure how to do them in javascript, so I'm hoping someone here can help me.  I mean, i can somewhat convert it but it'll be too mangled, I'd rather learn the right way.  I'm attaching the code and any help will be appreciated.  1 protected string CheckDateErrors(string dateGiven) 2 ...

Client side script calling Server side functions
Hi, I'm currently developing an enabled aspx page that contains a usercontrol (which is based on the listbox but extends it to include icons to represent invalid data). I want the onClick event of the selected TR to call an server function which then populates the controls to the right hand side in the page. Obviously because the row is just rendered HTML overriden from the base class I can only assign a javascript function to the onClick event. So I need a way of calling a server side function that will populate th...

calling server side function from client side script
i have a web form that includes a function named "koko()" in its server side class i want to write a script code in in its HTML script that will be run at the client side, and this client side script will call the function "koko()" from the server side. in brief : i want to call a server side function from a client side script... can you help me in this You can't call server-side code directly from client-side code. You can, however, trigger a postback that your server-side code watches for and triggers the server-side code appropriately. You can do some ...

Can I call a client side\java script function by clicking a menu item from the menu control?
I would like to use the menu control to populate a listview without the menu causing a postback.  Is there  way to call a javascript function by selecting a menu item.  Thanks for any help. HI, You can try to use ClientScriptManager..::.RegisterClientScriptBlock Method to call the client script of the page in the menu's MenuItemClick event. But you shold make sure the menuitems have no navigateUrl, or else the page will redirect to the navigateUrl without postback, so the MenuItemClick  event will not be fired. About the RegisterClientScriptBlock , you refer this...

how to call a c# function if user click on ok button of java script confirm box in .net
hi, i have one problem that is i'm adding the new user to database, if that user is already exist in the database one pop up should display with message like 'user already exists are u sure you want to update the role of the user' with 'yes' and 'no ' buttons on pop up, if user click on 'yes' button then it should call edituser() method of other wise it should reset the selected controls. how to do this using extenal .js file with javascript confirm box   Hi When user click on "Yes" set a hidden field value to be "t...

Calling another function in Java Script function
Hi , I am using input file control to get the list of files for eg Access MDB Once user selects a file I display the path and activate a button "Click to Get List of Tables" eg btn_Access In the button click I call a function to populate list of Access tables Now everytime user has to click the button . Since it is Input file control I have written a Java Script function to handle click event . Now I need to call btn_Access click function in this Java Script function How do I do it or is there some way to call C# function Thanks     You can use javascript to g...

How do I call server side function in client side script without using __doPostBack
Hello, My page has a server side panel that is hidden when the page loaded, checkboxes inside of the datagrid, and buttons.  If at least one checkbox is not clicked and the user click on the button, I show the panel.  When the user click on one of the checkbox, I want to hide the panel.  Onclick on the checkbox I already have a cleint function to change the row color.  I don't want to use __doPostBack.  Don't want to do postback. My question are: How do I either have checkbox onclick called both client and server side functions.  Or have the client side func...

__doPostBack function in .NET 1.x and .NET 2.0
It appears that the __doPostBack function has changed in .NET 2.0. The .NET 2.0 version doesn't seem to handle the conversion of dollar signs ("$") in generate control names to colons (":"). I'm using an Axezz datagrid inside of a MasterPage along with 3 other user controls in the MasterPage. The Axezz datagrid has sorting capablilites. When sorting is enabled the column have script attached to them that reads "javascript:__doPostBack('_ctl0$ContentPlaceHolder1$Grid1','orderby:5:1')" when the grid is rendered. The problem is that when I click on the column, the page post back, but the g...

Client Side script not functioning through IIS
Hello, I have some client side VBScripts which use the FileSystemObject and WScript objects. If I put them into a HTML page they work fine if I just run the page and execute the script. However, as soon as I serve them through IIS they no longer function as they can't create the Active X Component. I get the following error: Active X compnent can't create object: FileSystemObject or Active X compnent can't create object: WScript I guess it's a permissions thing but don't know IIS very much at all and have only just started with client side scripting. Any ideas? Hi, ...

List of client side function of extenders and controls for client side
Hello All,I am using AJAX control toolkit for my current project. Now I need to find out what client side functions I can call on an extender. Lets say I am using a PopControlExtender. Now I want to show the popup from a JS funtions.If I can do a guess then it would be something like this$find('ppce').show();From where I can find what client side functions I can call on those extensders. This is really a frusterating thing. I learn about extenders only from Learn tutorials, no help here and there. Can anybody please tell me where are documentations about all the extenders in the tool...

Web resources about - java script function in .net function -

Wave function - Wikipedia, the free encyclopedia
... (a ball attached to a spring ) in classical mechanics (A-B) and quantum mechanics (C-H). In quantum mechanics (C-H), the ball has a wave function ...

TV binging, exercise skipping linked to poor cognitive function
... their fit, less TV-addicted counterparts. In particular, couch potatoes had slightly lower brain processing speeds and worse executive function, ...

iPhone best tricks and functions - Business Insider
Your iPhone can do a lot more than you think.

Review: HP Spectre 360 A Perfect Mix Of Style, Form, Function
HP Inc. delivers a brushed-aluminum laptop with a new 6th Generation Intel i7 processor, making it one of the best-looking, best-priced and best-performing ...

Why Global Corporations Need To Redesign Their Strategic Planning Function
Corporate strategy teams play an important role in guiding business leaders to make smarter, better and more informed decisions, especially in ...

Sponsored post: Garmin’s fenix 3 Pairs Form and Function with GPS Watch
... timepiece to polish off a professional look, or strap on a rugged stopwatch for our workouts. But when it comes to everyday use, the functional ...

Code Craft – Embedding C++: Timing Virtual Functions
... compiler just like the standard language types. A subtype inherits the characteristics of its parent type and can use, or not, the member functions ...

Madras HC asks police to allow Tipu’s birth anniversary function
... Station on a petition filed by Ismail, General Secretary of Thamizhaga Makkal Jananayaga Katchi, seeking grant of permission to hold the function. ...

Colorado governor: This Planned Parenthood shooting may be a function of inflammatory rhetoric from bloggers ...
Via Grabien , skip to 4:45 of the clip below for the key bit. I naively thought we were (mostly) done with “climate of hate” stupidity after ...

Surprise: Binge-Watching TV May Cause a Decline in Brain Function
With the second season of Transparent only a few days away, some bad news awaits us: According to a recent study and common sense, probably, ...

Resources last updated: 12/6/2015 8:39:13 AM