473,394 Members | 1,189 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Codebehind unaware of select box members populated via javascript

I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own
state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client-side?
Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulation code
just not done in ASP.NET?

Thanks...
Nov 18 '05 #1
5 2109
Hi Allan,

Although I haven't tried it, I'm wondering whether you could use a hidden
server-side input box as a storage area for the populated data. Unlike the
dropdownlist boxes, input boxes are meant to collect user data.

Maybe you could store the values in some type of delimited string
"blue|red|black" that you could parse on the postback and add to the
listbox?

I could be way off the mark here, but thought I would raise the possibility
in case in sparks something else that suits.

"Allan M." <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own
state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client-side?
Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulation code
just not done in ASP.NET?

Thanks...

Nov 18 '05 #2
Yea, I've thought of that. That will work to some degree,
but it's still just a little bit less cludgy than what
I've already got working.

I wish there was a way for the codebehind to pick up what
values are populated in various dropdowns via client-side
javascript, without having to write all of these custom
code hacks.

The other option I looked at was moving all of our
existing server side control validation routines to client-
side javascript. Then the page could only be submitted
when it was actually DONE. This would prevent the need
for separate state management mechanisms for javascript
populated select boxes, because there would be no need to
redisplay the form the user fills out. Either the form is
posted processed or a client side validation script would
halt the form post.

Once again more javascript. Yuck! There's got to be a
better way to marry the robust responsiveness of client-
side scripting and server-side ASP.Net functionality.
This all-or-nothing (client-side vs. server-side) coding
methodology really bugs me!
-----Original Message-----
Hi Allan,

Although I haven't tried it, I'm wondering whether you could use a hiddenserver-side input box as a storage area for the populated data. Unlike thedropdownlist boxes, input boxes are meant to collect user data.
Maybe you could store the values in some type of delimited string"blue|red|black" that you could parse on the postback and add to thelistbox?

I could be way off the mark here, but thought I would raise the possibilityin case in sparks something else that suits.

"Allan M." <an*******@discussions.microsoft.com> wrote in messagenews:05****************************@phx.gbl...
I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client-side?
Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulation code just not done in ASP.NET?

Thanks...

.

Nov 18 '05 #3
hi
I m not sure to which answer you are looking for. But easy
and simples way to connect a server side control to the
client side control is
<controlname>.attributes.add("<event name>","<javascript
function name>");

Hope this answer might gives you some solution.

thanks
srinivas moorthy

-----Original Message-----
Yea, I've thought of that. That will work to some degree,but it's still just a little bit less cludgy than what
I've already got working.

I wish there was a way for the codebehind to pick up what
values are populated in various dropdowns via client-side
javascript, without having to write all of these custom
code hacks.

The other option I looked at was moving all of our
existing server side control validation routines to client-side javascript. Then the page could only be submitted
when it was actually DONE. This would prevent the need
for separate state management mechanisms for javascript
populated select boxes, because there would be no need to
redisplay the form the user fills out. Either the form isposted processed or a client side validation script would
halt the form post.

Once again more javascript. Yuck! There's got to be a
better way to marry the robust responsiveness of client-
side scripting and server-side ASP.Net functionality.
This all-or-nothing (client-side vs. server-side) coding
methodology really bugs me!
-----Original Message-----
Hi Allan,

Although I haven't tried it, I'm wondering whether youcould use a hidden
server-side input box as a storage area for the populateddata. Unlike the
dropdownlist boxes, input boxes are meant to collect
userdata.

Maybe you could store the values in some type ofdelimited string
"blue|red|black" that you could parse on the postback

andadd to the
listbox?

I could be way off the mark here, but thought I wouldraise the possibility
in case in sparks something else that suits.

"Allan M." <an*******@discussions.microsoft.com> wrote

inmessage
news:05****************************@phx.gbl...
I have a series of select boxes that must be populated
client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members populated via javascript. So, I'm having to create my

own state management solution, (i.e. rewriting the VIEWSTATE mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client- side? Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulationcode just not done in ASP.NET?

Thanks...

.

.

Nov 18 '05 #4
Hai
Hi Allan,

Regarding avoiding round trips to server I had in my application to use
Javascript to generate shopping basket.
My entire section (div) basket is generated via Javascript.
Part of the code I wrote was:
parent.frames["basket'].orderdiv.innerHTML = sOrderString;

WHenever possible I write Javascript to eliminate round trip to server.

HTH

Hai

"Allan M." <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own
state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client-side?
Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulation code
just not done in ASP.NET?

Thanks...

Nov 18 '05 #5
The browser technology (http, etc) is designed to post to the server a very
limited set of information. The "value" attributes of data entry fields
(<input> <textarea> <select>) and cookies. The list of text in a droplist is
simply formatting, not data. So it cannot be transferred.
The suggestion was made to transfer the value using a hidden input field.
This is a very popular way of transferring data that doesn't directly appear
on the page. Microsoft uses this to post back a button's command name via
the "__doPostBack" function you see on some of your webforms.

If you are thinking of getting validation on the client side to help,
remember that many browsers do not support client-side validation. (I sell a
product called "Professional Validation And More" that supports many more
browsers than Microsoft's validators.
http://www.peterblum.com/vam/home.aspx.)

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Allan M." <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
Yea, I've thought of that. That will work to some degree,
but it's still just a little bit less cludgy than what
I've already got working.

I wish there was a way for the codebehind to pick up what
values are populated in various dropdowns via client-side
javascript, without having to write all of these custom
code hacks.

The other option I looked at was moving all of our
existing server side control validation routines to client-
side javascript. Then the page could only be submitted
when it was actually DONE. This would prevent the need
for separate state management mechanisms for javascript
populated select boxes, because there would be no need to
redisplay the form the user fills out. Either the form is
posted processed or a client side validation script would
halt the form post.

Once again more javascript. Yuck! There's got to be a
better way to marry the robust responsiveness of client-
side scripting and server-side ASP.Net functionality.
This all-or-nothing (client-side vs. server-side) coding
methodology really bugs me!
-----Original Message-----
Hi Allan,

Although I haven't tried it, I'm wondering whether you

could use a hidden
server-side input box as a storage area for the populated

data. Unlike the
dropdownlist boxes, input boxes are meant to collect user

data.

Maybe you could store the values in some type of

delimited string
"blue|red|black" that you could parse on the postback and

add to the
listbox?

I could be way off the mark here, but thought I would

raise the possibility
in case in sparks something else that suits.

"Allan M." <an*******@discussions.microsoft.com> wrote in

message
news:05****************************@phx.gbl...
I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.

The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select boxes
after a postback occurs.

Is there an easier or better way to do this client-side?
Note: Postback is not an option. That is the way the
code was originally written, but end users were very
unhappy with round trips to server.

I need a way to be able to update controls using
javascript and include the information in the viewstate
whenever a postback occurs. Is this possible, or is
mixing client-side and server-side form manipulation code just not done in ASP.NET?

Thanks...

.

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list...
1
by: RJN | last post by:
Hi In the mainscreen I have a datagrid and from here I open new windows on click of link button. And I'm doing it through RegisterStartupScript Me.RegisterStartupScript("PopUp", _ "<script...
4
by: Bob P. | last post by:
Hello, I have a page with: * two side-by-side asp:listboxes and two arrow asp:buttons allowing users to add/remove email addresses between them -- very much like Outlook, where you have the...
4
by: Rob Shorney | last post by:
Hi, I am using .Net 2003 , c# asp.net. The situation i have is this. I have a asp.net page which in the codebehind maintains an xml document in memory. The user can click on a button to popup a...
6
by: RFS666 | last post by:
Hello, After I posted yesterday "using C# class in jscript", I have a new problem: I have a C# class - DBResult - that contains (and other variables) a string array (and other variables), that...
13
by: Oliver Hauger | last post by:
Hello, In my html form I show a select-element and if this element is clicked I fill it per JavaScript/DOM with option-elements. I use the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
4
by: RobertTheProgrammer | last post by:
Hi all, I know this is a trivial question, but I can't seem to figure it out. Pardon my inarticulation in asking the question... I'm using ASP.NET such that in the OnLoad event of the...
6
by: WT | last post by:
Hello, I am searching for a way to generate automatically from codebehind the <!Doctype....for asp.net pages using .net 3.5 c# and vs2008. Subidiary question: if I do a server transfert in my...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.