How to get a variable to Runatserver from Client Side Javascript

Here is a snippet of the Javascript Code

if (VarNotCompleted == "YES")

{document.getElementById("RatingLabel").innerHTML="Not Completed"}
It works fine but when I want to take the contents of the rating label back to the database it doesn't work. I am assuming the probem is that the Javascript is client side and nothing is registering at the server
How to I get the Javascript generated contents of Rating Label back to the server
This is the label
<asp:Label id="RatingLabel" runat="server"></asp:Label>
Any ideas

4/2/2004 5:35:50 AM 24353 articles. 1 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 7

submit a form with the value contained in it.
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable

Jason Brown - MVP, IIS
4/2/2004 6:08:33 AM
u cannot get label values to server side.

the label data is not stored in viewstate.
so try like this.
place the label value in a hidden variable with runat=server.
u can get the value even if the postback is done as the hidden varible value is stored in viewstate.
i think this cheaky but works for u.
4/2/2004 10:31:00 AM
> u cannot get label values to server side. 

that's why I suggested the form solution....
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable

Jason Brown - MVP, IIS
4/2/2004 10:37:48 AM
Thanks for replying. Problem solved.

For other Learners the javascript code now is
if (VarNotCompleted == "YES")

{document.getElementById("RatingLabel").innerHTML="Not Completed";
document.getElementById('AAARating').value = "Not Completed"}
document.getElementById('AAARating').value = VarRating;}

Under the Form Tag is
<input id="AAARating" type="hidden" name="AAARating" runat="server">
4/2/2004 9:45:19 PM

Similar Artilces:

Getting my client-side variable over to server-side
Ok so I have looked at a few posts on this subject and I can't quite figure out how to apply the idea to what I am doing here. I am using javascript to take amounts from 7 different textboxes and add them up on the fly, dropping the total in the 8th textbox. After they fill in that information they click button (postback) to continue throughout the form... what I need is for the "textboxTotalAmt" to move from client-side to server-side.  So I can access that total amount later in the form. Here is the Javascript piece... <script type="text/java...

server side variables in client side javascript
I want to use an variable in client side javascript.In regular asp I used hidden fields.what is the best way to do this in ASP.NET ?thx,Intersee my blog at and check the future of open mobile widget solutions at By and large, I personally still use Hidden fields to store information, that either my Javascript function or my code-behind use.  I barely use the RegisterScriptBlock method(s) and that is only for situations where I want to be really dynamic with the client side functionality.  95% of the time, I can still use a...

Getting hidden variable value from server side in client side
hi,        I am struck in problem. I have a hidden field in my form and i am setting some value in that.         Now i wnt to use this value from client side but i m not able to retrieve it. All i am getting there is an object.         I feel the hidden field is not able to hold that value.         <input type="hidden" id="hdnVar" runat="server" />         in code behind      ...

How to write data to a file in client side using javascript or someother client side scripting language.
Hi, I would like to know how to write a data to a client side file using javascript or someother client side scripting language. The file type expected is ini file. txt file would also be appreciable. Thanks in advance.   If the site is a trusted and you are running IE then you could try The Old Sewing FactoryThat twitter nonsense. You can write to the server, but not to the client's machine.  Being able to do so would be a huge security breach.When you ask a question, remember to click "mark as answered"...

Getting Value from Client-side InputBox to .net variable
hi, im doing a login page for our timekeeping. Since there's no msgbox available on, im doing it dynamically via javascript. How do i Get the value frm a dynamically written javascript (such as inputbox) to a .net variable? here's the logic of my program, user logs in hits the button and sub-routine Login will be fired, if user is late -- call Check_Late Sub, this is whre the client-side script was built -- then after that i wanted to be able to get the value from an inputbox. '// if button login clicked Sub Login(Sender As Object, E As EventArgs) .......

how do i get selectedValue of drop down list server side if i am populating it using client side javascript?
 Hi All.I am populating a drop down list client side using: The drop down list is populated based on a selection of another drop down list. ddlList.options[i] = new Option(1,2); as an exampleThe populating is done as i need it to. However, a button click event i am trying to get the selectedValue of the ddlList. However, it doesn't give me it. It only gives me the selectedValue of the drop down list on first rendering. Any ideas on how i can get it?   Could You paste some code? That would be helpful. Thanks S@ss (Shashi Shekhar Singh)My BlogPlease mark a post as ANSWER ...

Passing Client side variables from Java script to sever side variables
HiI have some code that worked fine in Net 1.1 but now doe's not work in Net 2.0 what I want to do is pass a couple of variables generated in javascipt on the client side to the server to use in server variables, below is the code that used to work var imageheight,imagewidth;imageheight = (document.images[0].height) + 80;imagewidth = (document.images[0].width) + 50; <!-- WindowWidth and WindowHeight are hidden Input feilds document.Form1.WindowWidth.value = imagewidth;document.Form1.WindowHeight.value = imageheight;Up to the imagewidth and the imageheight variables it works in so ...

Client Side Javascript and Dynamic Client Ids
I have a gridview that has an edit row.  When I click on edit... It pops up a inline window with modal functionality in the css... I want to fire off a webservice to bring back data to populate the input fields on the form I created... one catch I created a tab container with panels to separate out the keyed in information... So, I found that the .net is doing this to the inputs...  <input name="ctl00$cphMainBody$tcEmployeeDetails$TabPanel1$txtFirstName" type="text" maxlength="25" id="ctl00_cphMainBody_tcEmployeeDetails_TabPanel1_txtFirstNa...

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

how to transfer client-side variable to server-side
hi all, i need just a small hint on how to go on... i am adding attributes to a rows in a gridview when data is bound e.Row.Attributes.Add("onClick", "MySelectedRow.text = '" + e.Row.DataItemIndex.ToString() + "';location.href='admin_contact.aspx'") this allows me to store the selected row in a hidden field (MySelectedRow). after the page is being resubmitted it resets the value of the hidden field to null. i need to have the value on the server-side. i prefer not to do the querystring unless you know how to clear the querystring i...

Passing variable between client side and server side
For example,how do I pass the return value of the confirm("whatever") to the server side? Or the opposite way.  I want to use a cookie to do is. Can some one give me hint.  Much appreciate your help.   Chen  Please "Mark as an Answer" if you think my post had helped you!Thanks. you can use ajax,javascript and cookies also.  Got what you needed. Please mark as answer. In the aspx file: <input type="hidden" id="confirmAnswer" name="confirmAnswer" runat="server"> That adds this to the...

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

get server side datetime but run at client side
How do I get the server side datetime eg( 4 Aug 2006  6:12 : 01(seconds) AM  ) which the time is something similiar to ticking clock, once it get the server side datetime, it will pass to the javascript. From javascript it will increment the second by one, it is just similiar to ticking clock, after 10 seconds it will synchronize to the server datetime which means it get the latest server side datetime.   Is there any guide ? thanks in advance!!!kiwi_cyh Hi, It seems you want to synchronize the time in client side display with the server. You can use asynchronous clie...

Accessing server-side variables from client-side events
This is a multi-part message in MIME format. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In a client-side itemchanged function, how can I set a server-side = variable?? I simply need to execute the following: psSession.SetValue("userID", user_id); I'm sure there's a way to trigger server-side script and pass in = variables. Any suggestions?? Thanks. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/html; charset="iso-8859-1" ...

Web resources about - How to get a variable to Runatserver from Client Side Javascript -

Live Mesh Resource Script Demo
In the Live Framework Programming Model Architecture and Insights session, Ori Amiga (standing in for Dharma Shukla, previously a WF architect) ...

MIX11: Las Vegas, April 12–14 / Vote for Canadian Sessions at MIX!
Microsoft’s MIX conference, which typically takes place early in the spring, bills itself as being about “The Next Web”. I prefer to refer to ...

TabTimes Tablet Strategy Conference - Sponsors
Apperian is a cloud-based Mobile App Management company that helps organizations with the spectrum of IT challenges in supporting users and their ...

Why Desktop Apps Would Be Bad News for Windows 8 Tablets
... done a bunch of work to enable a great experience there.” So how do developers feel? Alexandre Brisebois, a senior .Net developer at RunAtServer, ...

At the 2011 MVP Global Summit
Microsoft MVPs and the Summit “Look at this crowd,” I said, pointing to the people boarding Air Canada 541 late Sunday afternoon, the daily direct ...

Resources last updated: 1/10/2016 11:51:51 PM