Issue obtaining values in server-side from dropdownlist when updating value using client-side script in master page

Hi

I got a page in a contentplaceholder of a master page. There is two pulldowns. I populate the first one using server side coding and then use client-side javascript. So far so good. The issue is that upon a postback I try to collect the select value of the second pulldown and there is no data in the pulldown and no selected item. 

I tried using control.selectedvalue (nothing) or searching the form controls

Stringvariable = oForm.FindControl("Control")

Thing is I've done this before in 1.1 outside of a master page and it works.

Thanks in advance for your help

Julio

   

 

0
julior77
9/8/2006 5:26:49 AM
asp.net.client-side 24353 articles. 0 followers. Follow

7 Replies
444 Views

Similar Articles

[PageSpeed] 16

As you are using masterpage, you may try first find the contentplaceholder and then find control inside~
你好! Just FYI o_O
0
Gordon
9/8/2006 5:58:04 AM

Thans for the reply. 

I'm able to find the control just fine. I'm using the following:

Dim oExprmt As DropDownList

Dim oForm As Control

 oForm = Master.FindControl("ContentPlaceHolder1")

oExprmt = oForm.FindControl("cmbExperiment")

strText = oExprmt.SelectedValue

I'm able to find both controls but when I try to get the value is = "".

Thing is I'm able to see the values in the page and select one of them but not to collect them in the server.

Thanks

0
julior77
9/8/2006 2:59:38 PM

Is the list being databound again before you can check the value?  That will erase the current selection...

What happens if you try to get the value from Request.Form(myDDLname) instead? 

 


Peter Brunone
MS MVP, ASP.NET
Founder, EasyListBox.com
Do the impossible, and go home early.
0
PeterBrunone
9/8/2006 6:23:30 PM

The list is not been databound after postback. It should only contain the value assigned in the client side.

Using Request.Form(myDDLname) only returned empty. As if no data was ever selected in the client.

 

0
julior77
9/8/2006 7:01:34 PM

Try Response.Write(Request.Form.ToString()), to see if the name is what you expect it to be.

 


Peter Brunone
MS MVP, ASP.NET
Founder, EasyListBox.com
Do the impossible, and go home early.
0
PeterBrunone
9/8/2006 7:26:36 PM

That is interesting. followed your advise and the name of the control in the client is:

ctl00%24ContentPlaceHolder1%24cmbExperiment

But on server side, the name of the control in the client is (using control.ClientID

ctl00_24ContentPlaceHolder1_24cmbExperiment

 using either returns Nothing

?Request.Form("ctl00%24ContentPlaceHolder1%24cmbExperiment")

Nothing

?Request.Form("ctl00_ContentPlaceHolder1_cmbExperiment")

Nothing

But the instruction you provided shows

ctl00%24ContentPlaceHolder1%24cmbExperiment=2

So the value is there, I just can not access the value.

0
julior77
9/8/2006 7:45:08 PM

That name from Request.Form has encoded characters.  If you call View Source on the page, you'll probably see what the *real* name is.

Of course this shouldn't be necessary (there should be a way to get the value from the control) but it's good to know you have other options like this.  I use Request.Form all the time in ELB to avoid ever having to touch Viewstate (keeps the users less confused when their values don't disappear after databinding).


Peter Brunone
MS MVP, ASP.NET
Founder, EasyListBox.com
Do the impossible, and go home early.
0
PeterBrunone
9/8/2006 7:57:53 PM
Reply:

Similar Artilces:

How can I set client side values as server side values?
Hi, Can anyone tell me how I can get client side values such as document.referrer, navigator.appName etc... into server side scripts? There are some client side values I'd like to set as session vars and insert into the db? How do I go about this? Thanks for any pointers Davlon PS (I'm using powersite 7.1.0.300) Pass them as page parameters, e.g., http://myserver/myurl?document.referrer=whatever&navigator.appName=yadayada Then, in your server-side script, just loop through the document.value array and get these values. -- pbm_hopethishelps, Roy Kie...

How to pass param values from server side to client side scripts
Hi, I have a page containing a datagrid with a list of geographic positions of interesting places. Users can filter this grid. Clicking an item the system displays the place on a map using MS Virtual Earth map component that exposes a client side javascript api. My problem is that the filtering is done on server side, but the map runs on client side. So during page load, I need to create long strings containing complex javascript codes on the server side, and add it as an event handler attribute to my components. This causes a lot of problems, for exemple...

Client-side values to server-side ?
Hi! My previous query is attached below: I have implemented the below mentioned implementation . 'listbox1' on 'webform1' shows all the values from 'webform2'. I have implemented it using javascript. I would like to know that to implement validation on 'webform1', I would require the values of 'listbox1' ,which are on the client-side , to move to the server-side . I think sending a querystring will be fine but how to implement it using javascript and code-behind(C#)? Your suggestion will be appreciated. Thanks and regards, ap.       My previous query: " I am stuck wi...

Client Side values to Server Side
What is the best way to transfer Client Side values to the Server side? For example I have a variable "var1" in javascript. var1 = "sample"; How can I acquire this value in the server side?  What is the best approach for this?  Barry to send the value to the server during a postback, you need to place the value in an input control.  You could consider using a hidden textbox for that purpose.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ In the JavaScrip...

textbox value set on client side, is not visible on server side or, on the source of the page.
hi, I have a textbox on my webform. the first time I load my page I fill this textbox with  "name" on the server side. once the page is loaded I set the value of the textbox to "thisIsme" with client side code. I even see a different text in the texbox. client side:document.all('txtnameInput').value =  'thisIsme'; server side:Me.txtnaam.Text 'is stil "name" and not "thisIsme" Why is this happening? on the webpage I see the text "thisIsme", but when I look at the source of the webpage I still see the old value in it. it's very odd... I am NOT setting the value back to "name...

How to pass the client side values to server side?
 hello to All,Actually i wanna implement a code like... a string in HTML textbox retrieve in server side control....suppose i hv a HTML control <input type="text" id="txtHTML"/>, and dis control  txtHTML.text="abc".now i want to retrieve dis client side string "abc" in d server side textbox named "txtASP"...which hs a property runat="server"so please give me an idea how to pass values from client side to server side.... hope u understand a problem... sam.  You could do this <input type="text"...

How to pass values from client side to server side
Hi, Is there a way to transfer variable from a client loop to a server loop. For example: var clitest = 'test'; Now I would like to get test variable from javascript into a server string variable <% sertest = ?? %> I understand that this can be done by storing a variable into a hidden control for example and than access it using server side, but when I have to transfer an array for example it get's a little more complicated. I was wondering is there more efficient approach? You can't transfer arrays, only strings. To workaround this problem pass delimited stri...

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

passing client side variable value to server side
 i have a grid and  by click on the rows, the onrowclick event is fired on client side. I want to pass the row index to the server side. As there are not sessions variables in javascript so i am stuck to pass the row to the server side.. I have made a texbox and set its valueto the index in the onrowclick event but when refresh calls, the text box became empty as the value set is on client side, i want page to persistthe value,  How can i do that? Tel me some way passing the row index to the server side?? Hi, You can call GridView_SelectedIndexChanging event on row click ev...

Check values in client side then go to server side
Hi, I am developing an application that allows users to update their personal informations. I want to check if mandotary fields are empty or not in client side with a java script when the user press the update button. If all mandotary fields are full(that will be decided with a java script), then server side function which updates the related database table will be run. How can I do this... I don't want to check mandotary fields in server side. I am sure, there should be an easy way. How ... ? Thanks. Sure... use a custom validator and name your javascript function to run. Inside...

how to pass values from client side to server side #2
Hi Guys....               This is Aani....I'm using ASP.NET in C# language.i have created one webpage for get input from user(from java script inputbox).i want that entered data in server side operations.how can i pass that value from client side server side.i need proper code in C# language.reply me soon... Thanks is Advanced... Regards....Aani plz use hidden field.ur assing values to text boxes through java script. before post back call a java scipt function to assign value to hodden fieed. even u can add these ...

How to get the Client side values in server side code.
Hi all, i have a proble i need to get the client side javascript values in C# code at server side. how can i pass those values? i am using version 1.1, i kno thatwe can use callback events mechnisam in 2.0 or ajax ,apart from that how we can pass? My problem is i need to stop the execution of the code based on after reciving values from the client   any ideas please???   Million thanks RamCheersRam MCP Hello Ram, a common approach is from javascript set an hidden field, then issue a postback. On the server-side, handle the post-back. Feel free to go deeper in your que...

Problem passing value client-side to server-side
I have a page that calls a pop-up while passing an encrypted value via a query string. The value is encrypted on the parent client-side in javascript so it needs to be decrypted client-side as well. This decryption occurs on closing the child (popup) and I am at a loss of when and how I should get this value to the server-side. On the popup you just want to process server side code? Anytime you can access for example the raw url:string raw = Page.Request.RawUrl;If you need to access any values on the client side you can access the url using javascript. Another idea is to, on the code beh...

Client side Values to Server values
Hi all, I'm using Visual Studio 2005 and C#.Net  I have one big security problem. I have one web page for user login. When user click in button "Login" i run some functions of javascript for detect pki credentials and i write the credentials in some textboxes. When the login process end, the user must click in another button for redirect the application to another page. I want pass the login credentials to target page, but i can´t use querystrings in url because is not secure ans i don´t want use cookies because some users have disableded cookies. I want...

Web resources about - Issue obtaining values in server-side from dropdownlist when updating value using client-side script in master page - asp.net.client-side

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 1/22/2016 6:41:54 AM