Client & Server Side ( Server PostBacks Reset Client Data )

Hi, Slight Problem i have bumped into, maybe someone can help me...

--TestSlider.aspx---------
<%@ Page Language="C#" %>
<script runat="server">
void click(object sender, EventArgs e)
{
Label1.Text = Label1.Text;
if(btnPress.Text=="Press")
btnPress.Text = "PRESS";
else
btnPress.Text = "Press";
}
</script>
<html>
<head>
<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('Label1').innerHTML = Math.round(theSpan.scrollLeft/theSpan.scrollWidth*9)+1;
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" BackColor="Transparent" Width="280px" Height="30px" BorderStyle="None">
<div id="slider1"></div>
</asp:Panel>
<asp:Panel id="Panel2" style="Z-INDEX: 101; LEFT: 9px; POSITION: absolute; TOP: 69px" runat="server" BackColor="Transparent" Width="280px" Height="30px" BorderStyle="None">
<div id="slider2"></div>
</asp:Panel>
<asp:Button id="btnPress" style="Z-INDEX: 102; LEFT: 10px; POSITION: absolute; TOP: 121px" onclick="click" runat="server" Text="Press"></asp:Button>
<asp:Label id="Label1" style="Z-INDEX: 100; LEFT: 324px; POSITION: absolute; TOP: 110px" runat="server">1</asp:Label>
</form>
</body>
</html>
--/TestSlider.aspx--------
In the above asp.net page, i have 2 Client Side sliders, which change the Value of the Label1 control.. When i press the Server Side button, it resets all of the sliders, and the value of Label1, if you look at the asp page in a web browser you will see what i mean, can anyone help...
http://www.fordax.com/testslider.aspx
-- Thanx Rik
0
TiBBy_Rik
12/19/2003 11:34:50 AM
asp.net.client-side 24353 articles. 1 followers. Follow

2 Replies
1058 Views

Similar Articles

[PageSpeed] 19

You're really not doing the interaction between the server-side and client-side that I think you think you're doing.  

In your click event, you set Label1.text = Label1.text. It started at 1, it's still 1, it's 1 now. Changing the contents of a label client-side doesn't make that value accessible to the server-side postback. You need to use something like a hidden form field that you change in step with the label or you can use just a textbox instead of a label and use styles to hide the border so it looks like a label. You need to use an element whose value is passed back to the server upon postback.
Then, with your sliders, you need to use that value that gets posted back to pre-set them to the value they should be at. They're not server controls so ASP knows nothing about them and won't maintain viewstate for them.
0
pdraigh
12/19/2003 1:07:09 PM
yeah im with you, lol, thats Label1.Text = Label1.Text was just a test, forgot to take it out, I gathered it wasnt sending the information back to the server. just wanted to find out how it would be sent back, The textbox idea is a good idea.. thnx

0
TiBBy_Rik
12/19/2003 2:15:50 PM
Reply:

Similar Artilces:

sending data from client side to server side without postback?
Hey guys, Im having a little bit of trouble to get this working in my page, i have some javascript in my page which displays rows selected from a dropdown list. asp dropdown just errors when i try to use selectedindexchanged and when i add runat="server" to the <select> the javascript doesnt fire off. so im trying to make the javascript store this value into something where its accessible by my backend code and my C# can pick it up (like a hidden text input or something), but at the moment it isnt working :(Code: <script type="text/javascript">function Sh...

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

SERVER SIDE DATA VALIDATION ON CLIENT SIDE
I wonder if this is the right forum to post this question because it is an issue about both server and client side processing. I am developing a web application (online store) which will run in a hosting company. Users accessing this app will be able to place orders with one limitation; the store has a schedule to accept orders. For example, it can be open from 8AM to 10PM and/or it can be closed on Mondays. I just can't validate time and/or day directly because time zone may lead to wrong results. So I thought about getting the schedule information, which is saved in my database, ...

UPdating Client Side from Server Side with no Postback??
  I have an application that I am porting to .net.  It is a Web Form that imports an Excel File and Dumps it into a Database record by record.  I want to be able to update the Clientside as to what record I am on in the excel file.    How using .net web form can I update the client side without doing a postback?Rico Rodriguez Try using Ajax.Net, you can read more about it at : http://ajax.asp.net German Afanador I am using Ajax.  I don't have any idea still as to how to post back to the client side with status updates while processing...

Problem between client-side & server-side
I have two select controls (HtmlControl) here. They are set to runat='server'. I've bind some data to them when create. I also have a cliet side script to change them one's option to another using javascript. The question is how i can get items of theirs when they're posted back? The controls are like this: <SELECT language="jscript" id="LbFrom" ondblclick="return LbFrom_ondblclick()"multiple size="9" name="Select1" runat="server"> <option></option>'some option here .. .. .. </selec...

Client-side & Server-side cursors
HI,What is the difference between  Client-side & Server-side cursors? How do we define and use it?Which is default one that .net program uses?Thanks Here is an acronym I learned on another forum. JFGI. MS article   Another good articleBeware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth)...

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

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

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

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

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

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

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Web resources about - Client & Server Side ( Server PostBacks Reset Client Data ) - asp.net.client-side

HasOffers Customers and Partners Event - Postback 2013 Tickets, Seattle - Eventbrite
This is going to be an incredible event with some of the smartest people in user acquisition, publishing, and performance advertising. Look ...

GeekWire Calendar Picks: Postback 2015, Hack the Dot Seattle, and more
Fast-growing Seattle startup Tune is holding its annual marketing conference, Postback 2015, at Seattle Center July 23 – 24. At last year’s event ...

ASP.NET MVC Framework - Wikipedia, the free encyclopedia
Based on ASP.NET , ASP.NET MVC allows software developers to build a web application as a composition of three roles: Model , View and Controller ...

Bentours - Travel Specialist Australia - Hotels, Tours, Flights, Cruises & Packages in Scandinavia, Russia ...
Bentours is a leading Travel Agent based in Australia. We fulfill our client's dream to explore and discover amazing travel destinations.


Amitech Business Solutions
Amitech Business Solutions, Creative Technology Startup ventures , Innovative IT company of India, allevents.in trendround

Drink of the Week - Logicum
Logicum It's Logical to share Menu Skip to content Home Contests Food Recipes Drink of the Week Health Technology Sports Space World Day Weapons ...

Publishers
Login An Adworkz Publisher gets paid for driving sales and leads to Advertiser Campaigns. Browse the network to find a campaign that matches ...

Sitefinity 4 Calendar Widget Released!
August 28th, 2011 I work for a software firm in Fort Wayne, IN. For the longest time, we used Sitefinity 3 as our standard content management ...

Second state of the Belgian Twitosphere
On April 17, 2007 I published the first state of the Twitosphere in Belgium , my home country. With this new state of the Twitosphere I want ...

Resources last updated: 11/28/2015 11:58:23 PM