How to take value from client side control from server side code?

Hi all,

I would like to know that, how to access client side control in server side code?

Here is an example..

I am having the textBox in client side like

<input type="text" id="textBoxUsername" name="textBoxUsername"/>

I need to take the value from this textBox in button click event which is server side code.

private void buttonShow(object sender, System.EventArgs e) {

//I need to access this textBox here.


How to do that?


R. eswaran.

2/18/2009 7:02:50 AM 93655 articles. 6 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 44
Get it on Google Play
Get it on Apple App Store


you need to make it run at server.

<input type="text" id="textBoxUsername" runat="server" name="textBoxUsername"/>

now you can fetch it as you fetch asp controls


Mark it as an answer, if it helped you anyhow...
2/18/2009 8:24:22 AM


You need to put attribute runat="server" to HTML controls to use them in code behind pages.


Please mark it as answer if this post seems to be useful.
2/18/2009 8:39:45 AM

Hi all,

No. I would like to know how to access that client control in server side code.

Is there any other way?



2/18/2009 8:55:26 AM


why can't you make the client control runat=server.

Tell us yr exact situation/requirement so that we can give better ideas/solutions. 

Mark it as an answer, if it helped you anyhow...
2/18/2009 8:58:02 AM

 Hi Eswaran,

The thing you are talking off is not yet provided in framework.  So please contact bill gates to include it in thier next framework.!

Please mark it as answer if this post seems to be useful.
2/18/2009 9:02:00 AM


No. I would like to know how to access that client control in server side code.

Is there any other way?



Another way would be using Request.Form like



"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
2/18/2009 9:04:20 AM

Similar Artilces:

Atlas client side control value available to server side C# code behind
I have an existing ASP.NET application. The page contains a datagrid (asp:datagrid). In my current C# code behind, I fetch data from SQL Server 2005 and bind to the datagrid when a button is selected (Click event). There can be many entires in the grid however, so the user typically enters text in a textbox as a filter on the returned results from SQL Server 2005. Now after studying an Atlas sample animalservice, with an HTML suggestion text box, I would like to use client-side Atlas to give the user a better indication of...

How to Pass Information from Server-Side Code to Client-Side Code in AJAX Control Extender?
Hi All,For some reason I can't get the following to work: I have a custom AJAX Control Extender with a few getters and setters. I also have some images I want to use with the extender saved in a resource file. How to I make the respective image URLs available to the javascript of the extender? Are there any examples available?Thanks![Update: renamed the subject to something more appropriate.]  Perhaps I can clarify a bit:I have set up a getter and setter to set the image URL from the resource file: 1 [ExtenderControlProperty] 2 public string CoverURL 3 { 4 get...

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

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in ( required field, range validator and others) question is the required field validator is a server side control. So does that mean that it does a post back? 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...

How to read cookies value on client side from server side code?
 I read an article which explains on how to read the client side cookies from C# code by doing something like://Grab the cookie 9: HttpCookie cookie = Request.Cookies[strCookieName];I am very confused here. Server side code in on the server side, so how can a server side code read the cookies on the client machine?I thought that only a client side script like Java Script  can read the client side cookies.Kindly explain...please.thanks.   Each time you request a page on a domain, the browser looks for a cookie for that domain on the client machine if it exists then it ...

Client side code to pass values to server side variable?
Hi there, I have ListBox_SelectedTextChanged() method that creates another list box in the runtime as follows: // Get Action Level List lbxActionLevel = new ListBox();lbxActionLevel.ID = "ddlA" + i.ToString(); lbxActionLevel.Width = 100; lbxActionLevel.Rows = 2;SqlDataReader dr = new BusinessLogicLayer().bllGetActionLevels(); lbxActionLevel.Items.Clear();while (dr.Read()) {ListItem lAction = new ListItem(); lAction.Text = dr.GetString(1).Trim();lAction.Value = Convert.ToString(dr.GetInt32(0)); lbxActionLevel.Items.Add(lAction); lbxActionLevel.SelectedIndex = 0; } I ...

web forms with client and server side controls??
Hi, I have a form that has client and server side controls. I have a problem in that any client controls (textbox) within the form runat="server" can not be accessed with client side code. Anyone got any ideas why and what work arounds are possible. Regards, Graham. once a form element is inside a <FORM> tag, you can no longer refer to it by its ID alone. you have to refer to it by formname.elementid or document.all.elementid. use document.getElementById(yourtextboxid) to get a ref to the element in the form. using this allows u to bypass the formn...

server side control passing value of self in client side function
I have a server side dropdownlist control.It contains values as:"#00FFFF""#FF00FF""#FFFF00"When the selectedindex is changed by the client I want to assign the value of the dropdownlist to a <div id="example"></div> evelement.pseudo:document.getElementbyId('example').bgcolor=dropdownlist.valueHow can I do this? I think I somehow need to attach a function to my dropdownlist which passes its own value as a parameter to a function...any suggestions?Thanks!please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already. You ...

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 - - Experts, Information, Ideas & Knowledge - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

Combining a server-side control with a client-side control!
Hi all, I am trying to combine a server-side control with a client-side control. I have created a listbox in both sides, the client-side control's code is: <select size="4" name="lstFruit" id="Select1" ondblclick="lst_dblClick" visible="false"> <option value="Banana">Banana</option> <option value="Apple">Apple</option> <option value="Mango">Mango</option> <option value="Orange">Orange</option> </select> The other one is the server-side control which has this code:   I wanted to add the ondblClick attribute to the se...

server side controls in a non-server side form
I want to use server side controls in a non-server side form.I use server side controls (like dropdownlists) so I can fill them with the right options from the database.My question is, what is the best way to approach this?CAN I use server-side controls in a client side form? If so, how can I get the values contained in the controls when I do a post? (not in a querystring).Here's a sample of my code: <form id="frmAdvancedSearch" method="post" action="advancedSearch.aspx"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <input type="submit" /> </form>...

What are diff Server-side control and Client-side control ?
What are diff Server-side control and Client-side control ? and diff server -side coding and client -side coding ? please help I have answered the first part of your question in your previous posting. Server-side coding languages are ASP, ASP.NET, PHP, CGI (Perl) and many, many more. They are used to create dynamic web content (based on additional information that is attached to the request) and are often used to extract information from databases. Client-side coding languages are JavaScript, VBScript, EMACScript and are used to create dynamic content that responds to the u...

Client Side validation of Calendar control prior to server side selectionchanged event code
Hello, Any thoughts or suggestions regarding this will be greatly appreciated. I have a Calendar control with the validation constraint(can't enter appointments on Holidays or on Thursdays). To create a smoother experience, I'd like for this to be done client side. The dillema is how can I intercept or precede the <asp:calendar> controls selectionchanged event from firing and run my client javascript; passing it to the server if validation succeeds for more intensive processing and database activity. The clientside javascript will need the selected date to deter...

Running javascript client side code from a web server control
Hi, I need to execute some client side javascript code from an server side control. For example, in an button server control I have code for server side click event and also code for onclientclick property. However, the code in the onclientclick property does not run. What is the correct way to execute javascript code from an server control? Regards, Sandyhttp://www.thequinn.infohttp://www.sksdataservices.com What you want to do actually? You can add attributes to the server control on page_load or use the ClientScript blocks. To add attr...

Web resources about - How to take value from client side control from server side code? -

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Tarago bushfire brought under control
A bushfire which burnt out close to 120 hectares near Tarago on Monday afternoon has been brought under control.

Hyundai recalls Elantra to fix stability control system
Filed under: Recalls , Hyundai , Safety , Sedan , Budget Starting in February Hyundai will recall 155,000 Elantras from the 2011 and 2012 model ...

Using Amazon Echo to control your home? There's a minor change you need to know about
It may be a minority who use the Amazon Echo to control home automation, in fact it likely is. But there are folks who do it, and it can, and ...

I've heard a rumor from Ground Control/Oh no, don't say it's true....
"David Bowie, the infinitely changeable, fiercely forward-looking songwriter... died on Sunday, two days after his 69th birthday...."

Sean Penn Interviews El Chapo for Rolling Stone… SHOCK: Magazine Gives Fugitive Drug Lord Editorial Control ...
Sean Penn interviewed fugitive Mexican drug lord Joaquín Guzmán Loera, known as “El Chapo,” who was captured and returned to prison Friday, for ...

Ford is partnering with Amazon to let you control your house from your car
Ford has announced a partnership with Amazon to bring the Echo's personal assistant speech technology into their vehicles. This will allow for ...

Want to Stay Comfortable? Ask Government to Mandate Temperature Controls on Thermometers
... ” should be considered for summer months, e.g. a maximum allowable temperature reading of 85 degrees Fahrenheit on all thermostats to control ...

Is There A Gun Control Issue Chris Christie Hasn't Flip Flopped On?
... while they are campaigning for a higher office, but I'm not sure if I've ever seen a man change his entire position on one issue (gun control) ...

Obama Spouts Falsehoods At Gun Control Town Hall
If Obama really had confidence in his case, he wouldn’t have to make up so many false claims.

Resources last updated: 1/12/2016 9:02:56 AM