How to execute server side code using VBscript bcz i need at client side.

How to  execute server side code using VBscript bcz  i need at client side.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim strSCript As String = "<script language=VBScript>Call load_LF()</script>"

If (Not ClientScript.IsStartupScriptRegistered("clientScript")) Then

Page.RegisterStartupScript("clientScript", strSCript)

End If

End Sub

here i am calling the vb script function i.e

<script type="text/vbscript" language="vbscript">

sub load_LF()



end sub


11/16/2008 8:04:52 AM 24353 articles. 2 followers. Follow

1 Replies

Similar Articles

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

The only way to execute server-side code from client-side code is by a PostBack or AJAX. Also using client-side VBScript is not recommended as it causes problems and will only work in Internet Explorer. Use JavaScript instead.

Here's a PostBack example:

<script type="text/javascript">
function load_LF()
 __doPostBack('load_LFPostBack', '');
// -->

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 ' Insure that the __doPostBack() JavaScript method is created...
 ClientScript.GetPostBackEventReference(Me, string.Empty)

 If IsPostBack Then
  Dim eventTarget As String() = Me.Request("__EVENTTARGET")

  If eventTarget = "load_LFPostBack" Then
   ' Execute your server-side function...
  End If
 End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 Dim scriptKey As String() = "Call_load_LF_Script"
 Dim javaScript As String() = "load_LF();"
 ClientScript.RegisterStartupScript(Me.GetType(), scriptKey, javaScript, true)
End Sub

Though I don't know why you are calling client-side script from server-side which then calls server-side. Wouldn't this work better?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 ' Execute your server-side function...
End Sub

No PostBack and no client-side script.


11/16/2008 1:12:17 PM

Similar Artilces:

Execute the client side and server side code
Hi, Hi, I have two drop down lists one ddl1, ddl2. when ddl1 index is changed I have to change the label before the ddl1 and contents of ddl2. 1) to change the label before ddl2, I am using the javascript like this:ddl1.Attributes.Add("onchange", "changeLabelText(this); return false;"); Javascript function<script language="javascript"> function changeLabelText(ddl) { var indx = ddl.selectedIndex; var lbl = document.getElementById('<%= lblSelect.ClientID %>'); if(indx == 0) lbl.innerHTML = "Select A:"; if(indx == 1)lbl.i...

Client side to execute server side code
I am maintaining an ASP.NET C# application written by someone else.  I am essentially a newbie to web development especially client side stuff.  Based on reading these forums I understand that I can't directly call a server side method from the client side and I have to use post pack in some way (using a webservice is not an option here).  My confusion comes from the HTML setup being used.The page has three frames; a header, body and footer.  Each frame is filled by it's own ASPX page.  The footer contains buttons for navigating to another page and some of the b...

executing server side code and client side (javascript) code simultaneously while clicking a button
how to execute server side code and client side (javascript) code simultaneously while clicking a button in You can't. When clicking a button: the client-side executes, the page does a PostBack, then the server-side executes.NC... what if i want to update a database and then open a new windows is it possible with

When to use client side varidation and server side varidation in .net?
In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks! Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.Here are a few references:Validating ASP.NET Server ControlsIntroduction to Validating User Input in Web FormsClient-Side Validation for ASP.NET Server ControlsSecurity Checklist...

client side code & server side code
what is the difference between client side coding & server side coding ? when to use client side & server side code? Client side code runs on the user's browser and includes languages such as javascript and vbscript. Server side code runs on the web server and can be written in languages such as ASP.NET, PHP, ASP, ColdFusion etc. Website Design Darlington - - Experts, Information, Ideas & Knowledge - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

when to use client side / server side?
Hey, Please can someone tell me when do i need to use a client-side or a server-side? For instance, I have a dropdownlist and when the user choses one of the listitems then click on the button to submit changes,i need first to validate the new value chosen by the user by comparing it with the old value and then redirect the user to the next page if there are no errors or view an error on the other hand! so in this case what's more preferable to use a JScript (client side) or on the click event of the button pressed (server side)! waiting the reply................. thanx in adva...

client side and server side code
Making things clear:When creating a web application one must know the difference between client side code and server side code.client side code is the code that is executed on the computer of the user. server side code is the code that is executed on the ....server.why is there client side code and server side code?well... server side code exist for the reason of sharing data with multiple users. for example: accessing a database.ASP.NET is a server side technology. in you can use different languages such as VB.NET or C#.client side code is used to perform tasks on the computer of th...

I need to get a server side button to run this client side code?
I need to get a server side button to run this client side code when the server button is clicked and then subsequently called by the server. Is it possible? The problem is that the print control is a client side activex. I can call it normally using a client side button but this is no good when I need to print more then one page. Any help would be great. Thanks. The code: function PrintProc(){ var MyPrinter; MyPrinter = new ActiveXObject("ImgXPrint6.ImgXPrint"); MyPrinter.PageFrom = 1; MyPrinter.PageTo = 1; MyPrinter.PageM...

Is it possible to call client side function from server side code without initial client request?
Atlas is great. I'm using timer to periodically check database changes on server to populate client side controls with new data. Is it possible to do it without a lot of client requests to server which takes a huge useless network traffic? Server should call client side function on all connected clients when, for example, 'database updated' event occurs on server. Thanks. Hi~ Just for your interest, I think you could have a look at Comet, many web IM like Gmail's embeded Gtalk and are built on this architecture你好! Just FYI o_O...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click ( and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Server-side execution vs. client-side
Hello, I am doing aspx web programming using vb in MS Visual Studio.  I am trying to make my program to when the user clicks on a button that my program launches another software package that we own (in this case the other software package is called Syteline).  The way that I am trying to accomplish this is via the CreateObject function route.  My program is running on the web server.  While I am sitting on the server that contains this Syteline application, I open up Internet Explorer and launch my web program.  When I click on the button, it gives me ...

Calling server-side code from client-side
Hi,  I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls:   And I want to "link" some key combination for the event handlers of the controls. Does anybody knows?  Thanks. You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button cl...

How to Excecute Server side code in Client Side
I have a Textbox with linkButton on right side.  if i click linkbutton i have one text box agian in poup. if we enter some text and click search button i am showing ListView with searched data in Poup. the Listview contains one Radio Button at eash row. Now my request is if i select one radiobuton and click "OK"  the poup should close and display the selected row text in TextBox in my Page where the Linkbutton Presents. i can do it on my server side on "Okbutton_Click" . i wabnt to do this in Client side only with out PostBack.   Is ther...

Client side and server side
We have a application, where we have some validation on the clientside using EnableClientSideValidation. If you don't have fullscreen you can't see some of the error-messages. What we want is to jump to the place on the page where the message is displayed. One problem is that the button is a serverbutton (runat="server"). How can we accomplish this on the clientside using the same button. I have tried to use "onClientClick" and a link something like this:   <A HREF=>form<...

Web resources about - How to execute server side code using VBscript bcz i need at client side. -

VBScript - Wikipedia, the free encyclopedia
.vbs, .vbe, .wsf, .wsc (.hta, .htm, .html, .asp) VBScript ( V isual B asic Script ing Edition) is an Active Scripting language developed by Microsoft ...

EMET security tool updated to prevent VBScript God Mode attacks
... Toolkit (EMET), a free exploit prevention tool, to protect against attacks that attempt to bypass Internet Explorer's sandbox using VBScript. ...

Microsoft EMET blocks 'VBScript God Mode'
... stop processes running malicious scripts via IE’s script engine. That’s good news as it’s a particularly powerful hack, and the basic " VBScript ...

Send HTML email from VBScript using CDO
Summary : VBScript to send HTML (and plain text) email. It's 2013 and apparently there are no tools that would allow you to easily test sending ...

Microsoft Security Advisory (981169): Vulnerability in VBScript Could Allow Remote Code Execution
... about this issue, including download links for an available security update, please review MS10-022 . The vulnerability addressed is the VBScript ...

Rumours of VBScript's Death Have Been Greatly Exaggerated
li.tag-item').show(); $('#TagLessLink').show(); $('#TagMoreLink').hide(); return false;" /> More ▼ li.tag-item').hide(); $('#TagMoreLink').show(); ...

Researchers find new PoS malware written in VBScript
In the wake of a large-scale attack on point-of-sale (PoS) systems at retailer Target, new malware designed to steal payment card data from the ...

Researchers find new PoS malware written in VBScript
... on Jan. 3. The release shows that cybercriminals are increasingly interested in launching this type of attack. The malware is written in VBScript ...

Office MACROS PERIL! Age-old VBScript tactic is BACK in biz attack
'Office macro exploits only cool thing Visual Basic used for,' quips securobod The dangers of allowing Office macros have been underlined by ...

A break from the past, part 2: Saying goodbye to ActiveX, VBScript, attachEvent…
We recently posted “A break from the past: the birth of Microsoft’s new web rendering engine”, an in-depth look at the background and motivation ...

Resources last updated: 1/16/2016 7:06:37 PM