JavaScript - Exposing Server-side State Through Client-side Controls

Feb 11, 2011

I have a list of items on an ASP.net page. That list is selectable in that whenever the user clicks on one, the page does a postback and the server code stores the index or some unique identifier of the picture in a ViewState property indicating that it is currently selected.

I would like to minimize the load on the server and therefore I would like to store the index or unique identifier representing the image in some way on the client side. The best way I can think to do this is to store said information in a hidden field ), however I had two questions about this before I go crazy:

Is this a security risk in any way, shape or form (i.e., exposing implementation details of the page)?
Is there a better/best way to do this that is more industry-standard? Does ASP.net provide a framework to do this that is cleaner than my idea? Seems like this would be a fairly common requirement to me...

View 1 Replies


Similar Messages:

Javascript - User Control With Client + Server Side CustomValidation; Wrong Client Side Validator Is Picked

Nov 23, 2010

I have a user control which contains a CustomValidator which is used according to whether a RadioButton is checked or not (there are several RadioButtons, I'm only showing the relevant one)

<asp:RadioButton runat="Server" ID="RadioBetween" GroupName="DateGroup" CssClass="date_group_options_control_radio" />
[code]...

There is some client + server side validation code (the server side code does exactly the same thing and is skipped for brevity)

<script type="text/javascript">
function ValidateDateFields_Client(source, args) [code]...

There are two instances of this control in the page. When running the client side version it hits the wrong one (the version of the control which is disabled). You can see from the generated HTML both are correctly specified. I'm not sure how .NET works out which clientside function to call given they both have the same name.

<script type="text/javascript">
//<![CDATA[
var ctl00_MCPH1_QueryTextValidator = document.all ? document.all["ctl00_MCPH1_QueryTextValidator"] : document.getElementById("ctl00_MCPH1_QueryTextValidator");

[code]...
Do i need to add something in to scope it? What's the best way to achieve this? If I disable the loading of the second control everything works fine.

View 1 Replies

Access Server Side Variable On Client Side And Vice Versa And JavaScript?

Dec 9, 2010

I have a requirement of adding server side variables in client side and other way round. Because I need to set a value from client side using javascript and access the same in code behind page.

I have to use C#.Net and JavaScript.

View 2 Replies

C# - Calling Server Side Function From Client Side JavaScript?

Sep 14, 2010

Possible Duplicates: how to call server side function from client side - asp.net Calling ASP.NET Code Behind function from Javascript Calling ASP.NET server side method via JQuery While loading an aspx page, how is it possible to call a server side method with the client side code?Can u show one example?

View 4 Replies

JavaScript - Pass Arguments From Client Side To Server Side?

Feb 11, 2011

I have two comboboxes and would like pass selected value and text to the server method (RadComboBoxItemsRequestedEventArgs) when the first combobox selected index changed.

Here is my code. But I am getting Javascript error message at this line. RadComboBox2.requestItems(item, false).

[code]....

View 1 Replies

JavaScript - Detecting Client-side DOM Changes Server-side - Is It Possible

Mar 7, 2010

I'm working on developing a custom control to select items from a predefined list. This is accomplished via 2 ASP.NET ListBox controls, with a few buttons to trigger the movement of ListItems from one ListBox to the other (lets call these ListBoxes lstSelected and lstDeselected).

This is easy enough to do in ASP.NET or JavaScript independently: I have both working. However, if modifications are made via JavaScript, ASP.NET retains no knowledge of this. Is there any way to register the creation of of options in a select tag without AJAX?

View 2 Replies

How To Convert Server Side Vb.net To Client Side Javascript

Mar 20, 2010

I've got a function I wrote quite some time ago that works fine, but I'd like to speed up the process and lessen server load by doing the same job in Javascript.I seem to be able to GET textbox values ok, but I can't seem to SET textbox values (I'm'-a JS noob). Can anyone lend a hand in converting my VB.NET code to it's JS equivalent?

Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles txtSellingPrice.TextChanged
Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", ""))
[code]...

View 2 Replies

Javascript - Get The Value Of Client Side Variable In Server Side?

Mar 24, 2011

I want to ask how to get the value of var title :

From this code :

protected void btnSubmit_Click(object sender, EventArgs e)
{
string script = "var title = $('.rsApt').attr('title');";
ClientScript.RegisterStartupScript(GetType(),"popup", script, true);
}

View 2 Replies

AJAX :: Can Send An Object From Client-side JavaScript To Server-side Code Via AJAX

Mar 16, 2011

I know that I can receive an javascript object from the server via ASP.NET AJAX using Json. But I am not sure how can I send an javascript object from my client-side javascript to my server-side code. And if I can, how can I extract this object in my server-side code and access its members?

View 1 Replies

Javascript - Client Side Validation And Server Side Validation In Java Script And Respectively ?

Sep 6, 2010

want to know that can we validate a control which is out side a form element in asp.net(server side validation)and outside a form element in html(client side validation) let's take a closer look

<html>
<body>
<input type="text" name="first name"/>
</body>
</html>

can we apply clien side validation on above text box by java script ?in asp.net

<form runat="server">
</form>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

View 2 Replies

Data Controls :: Unable To Get TextBox Inside GridView Values Modified Client Side Using JQuery On Server Side

Apr 30, 2014

i have a grid asĀ 

<asp:GridView ID="dgv_passengerdetails" runat="server" AutoGenerateColumns="False"
CssClass="pasdetailsgrid" BorderStyle="None">
<Columns>
<asp:BoundField HeaderText="Seat No" DataField="seatno">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>

[code]...

the string gs=null, if i click the button again then gs takes the value from textbox.

View 1 Replies

Javascript - How Much Client-side Programming Is Needed When Doing Server-side Programming

Mar 16, 2011

but I am rather confused about what to invest in. I heard that server-side code translates into client-side code. So, if you have an .aspx file, it will be converted to HTML/CSS/JavaScript. I have experience with the latter three technologies put into a rather dull text file and rendered by a web browser. My question is how much HTML/CSS/Javascript coding would I have to do when server-side programming? In other words, can someone using ASP.NET program purely on the server side and not bother to write for the client side? Of course, I don't care about server-side being translated into client-side, but I am wondering if client-side programming needs to be done explicitly and to what degree.

View 4 Replies

Web Forms :: How Do You Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox

[Code]....

but got a readonly error.

View 10 Replies

Jquery - Options For Page With Matching Client-side And Server-side Markup?

Oct 17, 2010

Suppose I'm building a StackOverflow clone using webforms ASP.NET and jQuery. The Question page has a question, several answers, and comments under each. Requirements:Users can post new answers and comments, and edit existing ones, without postbacks. No UpdatePanels; the AJAX calls retrieve just the JSON they need, not HTML fragments. The page loads with all existing answers and comments in place (no javascript needs to run to read the page).

What I'm trying to figure out is how to do this without having to maintain two sets of markup (one that's bound on the client using some form of jQuery templating, and one that's bound on the server using traditional WebForms).

View 7 Replies

Ajax - Listbox Items Client Side Reordering Not Reflected In Server Side?

Jan 5, 2010

I reordered some items in a listbox using Javascript. When I read the items in a postback in the code behind (ASP.NET), the order is in the original order. How do I get the same order as shown in the screen after Javascript manipulation?

View 3 Replies

AJAX :: To Know Error Like Username Or Password Is Incorrect On Client Side Instead Server Side?

Oct 4, 2010

I m using site login Control in my login.ascx file and disaplaying login control in Div so if there is login link in page and i click on that then Login Div will popup which is site login.May i know how can handle error like username or password is incorrect on client side instead server side?

View 6 Replies

Print The Aspx Page Either Using Server Side Or Client Side Approach?

Feb 9, 2011

I have to implement the print functionality on aspx page like on click of print image icon user will be able to get the print out of aspx page .aspx page will contain the server controls like textboxes , Gridview etc which one approach will be the best server side or client side printing ?

View 4 Replies

Web Forms :: Setting Hidden Value Server Side And Accessing On Client Side?

Jul 19, 2010

I am trying to set a hidden type value to x on Server Side and then access it with Javascript. I have tried multiple ways to accomplish this.

At the basic level this is what I am trying to do.

Aspx page
<asp:HiddenField ID="HidRowNumber" runat="server" />
CS Page
In IsPostBack
HidRowNumber.Value = EFileRowNumber.Text;
Javscript
var status = document.getElementById("<%= HidRowNumber.ClientID %>").value;

When I am debugin it say it HidRowNumber's Value has changed to x but when I access the value with JS it always returns ''.

View 23 Replies

Web Forms :: How To Unescape( Escaped HTML) By Server Side Not By Client Side

Aug 7, 2010

i can use escape() and unescape() functions by Client side easily, but the problem when i have use escape() method for peice of HTML , then i dont know how to unescape this piece of HTMl By Server Side not By Client Side. how i can unescape (escapped HTML) by server side?

View 2 Replies

Web Forms :: Retrieve Value If Server Side Control Value Is Updated On Client Side

Oct 26, 2010

I have a hidden variable and its value is being updated using javascript(client side) which I make a call from server side code. After making the call I am not able to retrieve the updated value from Server side variable. I went through this forum [URL] but not able find a way how to implement functionality with IFRAME. I am trying to call the client side code and retrieve the updated value from server side in page_load event.

View 5 Replies

VS 2005 AJax Tab Container - Enable The Server Side Not Client Side

Feb 4, 2010

I have set the ajax tabs disable on form load. ON button click, I want to enable the tab server side,not client side.

protected void btnEnableCostPetroleumTab_Click(object sender, EventArgs e)
{
TabContainer2.Tabs[0].Enabled = true;
}

But its not enabling the tab?

View 12 Replies

Server Side Control Hidden - Possible To Read Values Client Side

Jan 30, 2010

I've got two textboxes running server side and have their visibility turned off. I'm using a couple of ASP.NET controls which require the textboxes to exist. However, I am filling them from the code behind and would not like the user to see this. Can the user turn the visibility on and see the values entered in the text box? I tried using FireBug, and I couldn't seem to select the visibility option in order to edit it. However, I'm quite new to Firebug, so there may be another way? Or does running it server side mean that the client can't ever view the contents of the textbox?

View 1 Replies

First Invoke Server Side Code Then Client Side Script Without Using AJAX?

May 18, 2010

in a form i have a buttoin, when click both OnclientClick and postback should happen. on clicking the "Email" button a client side "mailto" tag should do the work and pull a new message window on the client's machine.

whereas, the email addresses should be invoked by the post back. so , when clicking the button the server side post should happen and on return the client side script should be invokded with the values read during post back, and populate all the email addresses.

i need know how to first do a server hit take the values and then execute the client script with those values without using AJAX

View 1 Replies

How To Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox: I can retrieve the value using Request.Form. But how do I go about populating this textbox from the server-side? I tried Request.Form["txtTest"] = "blah"; but got a readonly error.

View 2 Replies

Accessing Client - Side Generated Table Rows Through Server - Side

Feb 23, 2010

The idea is that a pure html table will be generated on the client side. (using jQuery to add dynamic new rows to the table when the user clicks a button). These rows contain textboxes, dropdownlists, checkboxes and other input controls. When the user clicks a button, a PostBack is triggered in which I need to access this data from the table on server side, validate it and perform other actions on it.

I'm able to perform the client side and access the table data on server side by adding runat="server" to the table tag. However, I only see the initial table rows (not the ones added through JavaScript) and I have troubles retrieving the different inputs from the rows. put me in the right direction?? Or someone offering a better solution to the problem?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved