Client-Side and Server Side Scripting

Hi, im currenty in the process of trying to get an asp.net page to work with both <script> and <script runat="server" tags...

idea being, i have a <script> tag which holds all the client side scripting for my webpage, at the moment this is just some slider controls which i have created (the scripting behind this is actually from someone on a different forum, which i have modified to do what i want..) - but i also want a <script runat="server"> tag to hold all the code for the buttons pressed etc in my web-page.
im trying my hardest not to use a code behind page, because i am creating software which will enable the drag and drop of controls onto the page, which will then output the asp.net webpage witl full functionality (you can imagine how much easier it is having to only output information to one file, and not having to go through creating a code behind page dynamically)
take a look
--------------
<%@ Page Language="C#" %>
<html>
<head>
<script>
function newSlider(sId)
{
sCode = '<table border=0>'
sCode += '<tr style="font-size:12"><td width="8" height="15"></td>';
for(var i=1;i<11;i++)
{
sCode+='<td width="10"><center>'+i+'</center></td>'
}
sCode += '<td width="8"></td></tr>'
sCode += '<tr><td colspan="11">';
sCode += '<span id="S'+sId+'" style="overflow-x:scroll; overflow-y:hidden; width:250; height=15;"';
sCode += ' onScroll="scrollSlider(this)">';
for(var i=0;i<1800;i++)
{
sCode+= "&nbsp;";
}
sCode+='</span></td><td>';
sCode+='<span id="LS'+sId+'">1</span></td></tr></table>';
return sCode;
}
function scrollSlider(theSpan)
{
sId = theSpan.id;
document.getElementById('L'+sId).innerHTML = Math.round(theSpan.scrollLeft/theSpan.scrollWidth*9)+1;
}
function init()
{
sArea = document.getElementById('slider1');
sArea.innerHTML += newSlider(1);
sArea = document.getElementById('slider2');
sArea.innerHTML += newSlider(2);
}
</script>
</head>
<body onload="init()">
<form runat="server">
<asp:Panel id="Panel1" style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 20px" runat="server" BorderStyle="None" Height="30px" Width="280px" BackColor="Transparent">
<div id="slider1"></div>
</asp:Panel>
<asp:Panel id="Panel2" style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 100px" runat="server" BorderStyle="None" Height="30px" Width="280px" BackColor="Transparent">
<div id="slider2"></div>
</asp:Panel>
<!-- Insert content here -->
</form>
</body>
</html>
--------------
thats with some sliders working (obviously this is just testing) - wat i need now is to be able to have a button working Server-Side..
Can Anyone help?
0
TiBBy_Rik
12/18/2003 12:43:40 PM
asp.net.client-side 24353 articles. 2 followers. Follow

3 Replies
1432 Views

Similar Articles

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

what i need now is to be able to have a button working Server-Side

Well, what have you tried?
Alister
0
SomeNewKid
12/18/2003 4:10:19 PM
i tried doing something like this

-------
<script language="Javascript">
Script for the Client Side Scrollers
</script>
<script language="C#" runat="server">
C# Code for the Button
</script>
------
this does not error the program, however it just doesnt actually do the code server-side, however the javascript does still work...
Here is the actual Sample i tried...
------
<%@ Page Language="C#" %>
<script language="JavaScript">
function newSlider(sId)
{
sCode = '<table border=0>'
sCode += '<tr style="font-size:12"><td width="8" height="15"></td>';
for(var i=1;i<11;i++)
{
sCode+='<td width="10"><center>'+i+'</center></td>'
}
sCode += '<td width="8"></td></tr>'
sCode += '<tr><td colspan="11">';
sCode += '<span id="S'+sId+'" style="overflow-x:scroll; overflow-y:hidden; width:250; height=15;"';
sCode += ' onScroll="scrollSlider(this)">';
for(var i=0;i<1800;i++)
{
sCode+= "&nbsp;";
}
sCode+='</span></td><td>';
sCode+='<span id="LS'+sId+'">1</span></td></tr></table>';
return sCode;
}
function scrollSlider(theSpan)
{
sId = theSpan.id;
document.getElementById('L'+sId).innerHTML = Math.round(theSpan.scrollLeft/theSpan.scrollWidth*9)+1;
}
function init()
{
sArea = document.getElementById('slider1');
sArea.innerHTML += newSlider(1);
sArea = document.getElementById('slider2');
sArea.innerHTML += newSlider(2);
}
</script>
<script language="C#" runat="server">
void click(object sender, EventArgs e)
{
btnPress.Text = "CHANGED";
}
</script>
</head>
<body onload="init()">
<form runat="server">
<asp:Panel id="Panel1" style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 20px" runat="server" BorderStyle="None" Height="30px" Width="280px" BackColor="Transparent">
<div id="slider1"></div>
</asp:Panel>
<asp:Panel id="Panel2" style="Z-INDEX: 101; LEFT: 9px; POSITION: absolute; TOP: 69px" runat="server" BorderStyle="None" Height="30px" Width="280px" BackColor="Transparent">
<div id="slider2"></div>
</asp:Panel>
<asp:Button id="btnPress" style="Z-INDEX: 102; LEFT: 233px; POSITION: absolute; TOP: 110px" runat="server" Text="PressMe" onButtonClick="click"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>
----------
Please, Any Help would be very helpful
0
TiBBy_Rik
12/18/2003 4:32:28 PM
HAHA - found the problem - i was using onButtonClick... 

its onclick..
wat was i doing :-) - ohh well..
suprised it actually worked at all really
0
TiBBy_Rik
12/18/2003 4:53:44 PM
Reply:

Similar Artilces:

client-side scripting or server-side scripting
I want to perform data validation in my page using javascript before the data is sent to my server, but I am very confuse that I don't know which way to perform, client-side validation or server-side validation? My javascript bible told me that javascript is a client-side scripting for data validation in client pc, but when I look in my asp.net bible, the validation part is done at server side. The worst is that, I find no way to use javascript in .asp or .aspx environment. I am really confuse with all these, could any one help me on this? Thanks. Use .NET validator co...

How to call a client side script from a server side script?
Hi guys, I have a Button1_Click function which gets executed on the server side as soon as Button1 is clicked. I have a client side function, test, which is  written in vbscript. I need to call this test function from the Button1_Click function. Can anyone of you please tell me how to do this? The test function is inside an asp:content tag (Please excuse my terminology if I am wrong, I am new to all this).  Thanks and Regards, RJ Have you tried to use the below code Button1.Attributes.Add("onclick","test()"); HCHaissam Abdul MalakMCAD.NET| Blog | Yes, ...

client side script Vs Server side Script
Which is better ? Using Client Side validations with Java Script or Using Server Side validation controls provided in asp.net You should use both... Client-side for a rich user experience and server-side to support browsers without javascript support or with javascript turned off....

Call server-side script from client-side script
Hi to all, I would like to ask you How can i call from client-side script a server-side script and to have the result from the server-side script in the client-side script. For example, i wand to call a function writing in server-side (DynaScript) script from a client-side script (JAVASCRIPT) and to have an answer from the function. Thanks in advance. Nick, One way that you could get round this is to write your client script code as you would server script eg. <SCRIPT language=javascript> function getValue()... would be written as: <% psDocument.WriteLn(&...

Client-Side scripting vs Server-Side scripting
hello I need an article that spaeks about Client-Side scripting vs Server-Side scripting,and when i need to use one of them thank you for the help and for the time here are some good links to a bunch of articles on that subject...

Difference between client side scripting and server side scripting
Hi,      Can u  plz, explain why the server side scripting is necessary, inorder to write the client side scripting. What is the main difference between the client side scripting and server side scripting. Client-side scripting is code that is executed on the client side, such as JavaScript. Server-side scripting is code that is executed on the server, such as VB, VB.NET, C#, or J#. For a better definition of server-side scripting and when it's necessary, please visit http://en.wikipedia.org/wiki/Server-side_scriptingRyan OlshanASPInsider | Microsoft MVP...

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@ http://www.devarticles.com/index2.php?option=content&task=...

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

Acessing Variable, declared in the client side script, from the server side script
I'd like to know how can I use variables declared in the client side script from the server side script. Thanks! You cannot. The only way is to pass them as arguments to the server-side script. -- Larry Cermak [Team Sybase] Corporate Technology Partners EAServer Training & Consulting Coming Soon: Web DataWindow Book Web DataWindow Articles: http://my.sybase.com/detail?id=1003371 "Jeong-Su, Hwang" <hjs@i4biz.co.kr> wrote in message news:s9YmFSfKAHA.201@forums.sybase.com... > I'd like to know how can I use variables declared in the cl...

Calling server side scripts from client side
Hello, Can Anyone help out from the following : It is regarding calling server side scripts from client side events. I am able to instantiate a jaguar component in the server side script written in the body of the HTML page as follows : <% var mycomp = java.CreateComponent ("pkg_dispatch/n_jaguar", "iiop://jaguar:9000", "Jagadmin", "" ); if (mycomp == null) { document.writeln("ERROR: failed to instantiate !"); return; } %> I want to use the instance of the jaguar component else wher...

Acessing variables, declared in the server side script, from the client side script
I'd like to know how can I use variables declared in the server side script from the client side script. P.S.: I'm using JavaScript in the server side script and in the client side script. I don't like to use ASP. Thanks! One example that come to mind: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=windows-1252" http-equiv="Content-Type"> <META name=GENERATOR content="MSHTML 5.00.2919.6307"> <SCRIPT language=JavaScript> ...

Server side Variable in client side script
Hello, I want to access the variable defined in the server side script from the client side. Can anyone help out with an example ??? TIA, Rakesh Babaria I think what you do is write is as a java script variable, so something like this: <!--SCRIPT var ls_serverVar ls_serverVar = "whatever"; document.writeln("<SCRIPT language=JavaScript>"); document.writeln("var xyz = " + ls_serverVar); document.writeln("</SCRIPT>"); --> Then in your client script, you'll be able to get XYZ. ...

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

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

Web resources about - Client-Side and Server Side Scripting - asp.net.client-side

Client-side scripting - Wikipedia, the free encyclopedia
... different and changing content depending on user input, environmental conditions (such as the time of day), or other variables. Client-side ...

Senior Search Manager - Client Side!!
... strategy insight for senior IT management - resources to understand and leverage information technology. Senior Search Manager - Client Side ...

Account Manager - Client Side - Previous Agency Experience Welcome!!
Computerworld Australia is the leading source of technology news, analysis and tools for IT decision makers, managers and professionals.

Media Sales Executive - Client Side!!
Technology news and reviews for business and home.

PPC Paid Search Manager - CLIENT SIDE
Defining Technology for Australia's IT Leaders. PPC Paid Search Manager - SEM - **CLIENT SIDE** Sydney CBD Location Client side!! SEM/PPC/Paid ...

How Basecamp Next got to be so damn fast without using much client-side UI
When we started working on Basecamp Next last year, we had much internal debate about whether we should evolve the existing code base or rewrite ...

Seven Tips for Pitching From the Client's Side of the Table
I had a chance to sit on the other side of the pitch table. Here is what I learned.

Client-side coding: How to prevent malicious use?
Applications that run on a user-controlled device cannot be perfectly protected.

The client side
... regarding the professionals you seek to assist. Even better if you possess that understanding yourself, having worked on the client side. I'm ...

Ecommerce traffic being hijacked by client side malware
According to new research 15 to 30 percent of eCommerce site visitors are infected with Client Side Injected Malware (CSIM) that causes them ...

Resources last updated: 12/4/2015 6:40:49 AM