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 ASP.net you can use different languages such as VB.NET or C#.

client side code is used to perform tasks on the computer of the website-visitor. this could be a messagebox or some effect in your browser or calling an activex object on the clients computer.
client side code can also be more than 1 language: vbscript, javascript....these are languages interpreted by the browser. in some browsers you may not be able to create all objects and in the same way.


when an asp.net page loads, all the server side code is executed first. Only then client side code can be executed.

in order to send user information to the server (because you want to save it to a database) you can use a form in your web application and post the data to the server. this will result in another load of your page.

you want to use server side variables in your client side code ?

well I suppose you will have to inventive to do that. using hidden fields is 1 way. hidden fields are invisible text fields that you can fill with server side data when your page loads.

Does a page have to reload everytime it gets data from the server?

No. it does not. to solve this problem you can use Ajax or the http request object. this is no longer a postback to the server but it is a call back. If you are new to server side programming, I suggest you first use a regular postback before trying to use http request.

interwanderer
see my blog at www.Interdevelopments.com and check the future of open mobile widget solutions at www.glowe.org
0
interwanderer1
11/6/2005 7:29:39 PM
asp.net.client-side 24353 articles. 2 followers. Follow

2 Replies
1362 Views

Similar Articles

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

As as you say, I can use hidden field to fill my server side data. I need to pass some data from vb code-behind to the client-side (HTML javascript). The problem is that when I want to pass an array of data from the dropdown list to the client-side, it only pass the selected value, which is only one value. This is not what I wanted. I want to pass an array of values, and not a single value. How should I do that?

VB Code-Behind:

Dim dataX(3) As Double

Dim dataY(3) As Double

For i As Integer = 0 To 2

Randomize()

dataX(i) = Int((Rnd() * 25) + 1)

dataY(i) = Int((Rnd() * 25) + 1)

DropDownList1.Items.Add(dataX(i))

DropDownList2.Items.Add(dataY(i))

Next i


Javascript at HTML view:

function showData()    {
           window.addChartValue = document.getElementById('<%= ddlData.ClientID%>').value,(document.getElementsById('<%= ddlData2.ClientID%>')),false);
}  



Thanks..
0
goblinkid
11/7/2005 12:53:35 AM
your dropdownlist is a asp.net server control.
you will be able to fill it with asp.net and will see it client side but I don't think you will not be able to use it in your client side script as if it is a html control.

you can format your data as xml. and use it like that in your client side.(still put the data in the hidden field).

or loop in your asp.net and put the data in 1 single string, devided by some characters and send it to your hidden field. and then split it up again in your javascript and use it client side for whatever purpose you need it.
see my blog at www.Interdevelopments.com and check the future of open mobile widget solutions at www.glowe.org
0
interwanderer1
11/7/2005 8:31:49 AM
Reply:

Similar Artilces:

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 - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

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 meebo.com 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 (Asp.net) 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...

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...

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: http://www.openjs.com/scripts/events/keyboard_shortcuts/   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...

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...

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...

What is Client Side and Server Side?
I am New of ASP.Net What we can and should do client side and Server Side? What uses? Please any one clear my doubt. Thanking YouEndendrum Priyamudan P m R Clientside is basically what a person can see and serverside is where actions get processed. that's kinda simply puyt but thats the deal, you code serverside, and the html and javascript it generates let's the users for example click a button, then serverside you have coded what should happen when a button gets clicked for example turn text red. Then the server sends a new page with red text to the client (clientside...

Server-side or Client-side
In general, I'm wondering if there are any criteria to use when choosing between using a client side element or a server side element. For example, if I'm going to put an HTML table on a page, how do I decide whether or not to use a server control?  Should the server side always be chosen or if there is not explicit server side functionality required is it better to opt for a "normal" client side table? Obviously, if there is a need for server side control the question is answered, I'm looking more at more ambiguous situations. Thanks  This is from Micros...

Server Side or Client Side
Hi I'm a bit confused about this whole server side / client side thing. Are applets, embeded objects consider client side? If I have a form within my aspx page which connects to a database on the server side what is it considered? If I have some business logic written within a VB file when the client access the functions within that business logic (for example some kind of validation function) does the client browser actually downloads that VB file? Can someone suggest how to differentiate between client side and server side components within a asp.net based website?  Hi, i can&#...

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=http://forums.asp.net/AddPost.aspx?ForumID=18#form>form<...

client-side and server-side?
hi, can someone tells me how diff is client side and server side are these two? When I tried to do validation ... I would use Javascript ... which has something like: document.forms[0] ... I think that's client side. My understanding on server side is the "form" ... like u will have <form action=".." method=post> ..... </form> ... so it will send to server ... am I on the right track? Are there any other type of server side examples? Hi, ASP.NET itself is server side. Every piece of code processed is done on a server. What comes out of this is sent ...

How to Pass Information from Server-Side Code to Client-Side Code in AJAX Control Extender?
Hi All,For some reason I can't get the following to work: I have a custom AJAX Control Extender with a few getters and setters. I also have some images I want to use with the extender saved in a resource file. How to I make the respective image URLs available to the javascript of the extender? Are there any examples available?Thanks![Update: renamed the subject to something more appropriate.]  Perhaps I can clarify a bit:I have set up a getter and setter to set the image URL from the resource file: 1 [ExtenderControlProperty] 2 public string CoverURL 3 { 4 get...

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 asp.net. 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 Jscript.net?...

Web resources about - client side and server side code - asp.net.client-side

MUD client - Wikipedia, the free encyclopedia
A MUD client is a computer application used to connect to a MUD , a type of multiplayer online game . Generally, a MUD client is a very basic ...

3Q Digital Offers Peek At 3Q Facebook Ad Performance By Its Largest Clients
With Facebook set to report its third-quarter earnings Wednesday , digital marketing agency 3Q Digital offered some insight on how the social ...

Gallop Labs hires former Facebook Client Partner as Director of Sales
Gallop Labs , a social marketing and analytics firm, announced that it has hired former Facebook Client Partner Andrew Peebles as the company’s ...

Acquire Learning casts 'a very dark shadow' over its clients
The desperate and jobless are sold hope, but all they are buying is debt "You can hear it in how these clients talk," says a former call-centre ...

Back In The Race: Should You Let Your Clients Pay You In 2016?
It can offer you tax benefits, but you need to consider your client's present and future circumstances.

Advertising on Torrent Clients Is Growing, but at What Cost?
You won't find brands like Gillette, General Electric or Crayola advertising on the Pirate Bay, the site where visitors can access oceans of ...

Dropbox is shutting down Mailbox, the popular email client
Dropbox acquired Mailbox, the extremely popular email client, way back in 2013, and unfortunately it's now time to say goodbye. That's right, ...

Chatting with coworkers, clients, friends and others is easy as Pie
... uses your companys domain). This also means that you can now set up teams to chat with people outside your company, including partners, clients, ...

Apple Says U.K. Surveillance Law Would Endanger All Clients
Apple Inc. outlined its opposition to a proposed U.K. surveillance law, saying threats to national security don’t justify weakening privacy and ...

The relationship between UPS and Amazon, its biggest client, is fraying
The relationship between Amazon and the United Parcel Service is fraying, The Wall Street Journal reports . The Amazon account at UPS is, according ...

Resources last updated: 1/2/2016 6:15:22 AM