Getting Textbox Value in Page Code Behind -

The client side webpage has textboxes displaying current information of a specific record (first name, last name, company, title,etc). This information is displayed, the issue becomes when that information is changed and the update button is clicked, how to get the value that was changed (if the text box already had a value), how to get the value if the textbox was empty. How to get the newly changed value  on the codebehind so that it can be processed through an update function. The update function is already written , the only thing that is needed is the new value in the textbox.


Added notes: each textbox has runat="server"

The textboxes are in a ajax tab container.



Software Coding Is No Monkey Business!
4/1/2008 1:44:19 PM 17816 articles. 1 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 19

The fact that it is within a TabContainer is irrelevant.  Just access it from your code-behind via


When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.

My latest ASP.NET AJAX blog entries.
4/1/2008 2:18:13 PM


The fact that it is within a TabContainer is irrelevant.  Just access it from your code-behind via


There is a value that is populated in the textbox when the page first opens from a database, it is once that value is changed and an update function is called. In the page code behind there is a statement

        Dim tempString As String
        Dim tempString2 As String

        tempString = txtFName.Text.ToString
        tempString2 = txtJobTitle.Text.ToString

        Debug.Print("FirstName: " + tempString)
        Debug.Print("JobTitle: " + tempString2)


The new changed value is not returned, the original value is still there....

Software Coding Is No Monkey Business!
4/1/2008 2:57:48 PM

 The page load was being called, which is why the value was returning as the original, adding the following in the Page_Load function did the trick


If Not IsPostBack Then

  * database populating code

 end if




Software Coding Is No Monkey Business!
4/1/2008 2:59:32 PM

Similar Artilces:

Getting Textbox Value in Page Code Behind
The client side webpage has textboxes displaying current information of a specific record (first name, last name, company, title,etc). This information is displayed, the issue becomes when that information is changed and the update button is clicked, how to get the value that was changed (if the text box already had a value), how to get the value if the textbox was empty. How to get the newly changed value  on the codebehind so that it can be processed through an update function. The update function is already written , the only thing that is needed is the new value in the textb...

get html textbox value in behind)
  i am new to Can anybody say how to get Input textbox value in b4 sending answer Thankx  string value = Resquest.Form["textboxname"].ToString(); Hi,There are two ways to access it. 1) Make it runat="server" and access it in code behind like textbox1.value2) Another way is by using     Request.Form["textbox1"].ToString(); I hope this will be helpful to you.Thanks, Alpesh DhaneshaPlease don't forget to "Mask as Answer" if it helped. just add runat =server to html  ...

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

How to get value into javascript from code behind page.....
Hello friends...               I want data from .cs file into javascript.How to do that.   Please help me...   HI Here i am sending a radibuttonlist selected text to the javascript function. foreach (ListItem li in optSearch.Items) { li.Attributes.Add("OnClick", "javascript:return GetSearchOptValue('" + li.Text.ToString() + "');"); } This way u can pass the value to javascript function. Thank Venky Hi,server code can be there inline also, for e.g.var controlvalue=document.getElementById('''<% any_server_textbox_or_label_control.ClientID %>') .value; but remember this will work only if the page is being rendered , you can't expect it work once the page is rendered fully on the browser, or for e.g. include server side code in .js files. SHASHANK BHIDECAPGEMINI INDIA"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)"  hi,Assign data to hidden controls from server side code and access those controls from javascript.  Mark as ANSWER if you got the solution from this post. Regards,Ravi Kishore.ChMark as "ANSWER" if you got the solution from this post. You can send data from code behind to java script like this.. Page.ClientScript.RegisterStartupScript(this.Ge...

how do i get the datakey value of a detailview in the code behind page
how do i get the datakey value of a detailview in the code behind page Here is an example of     string test = Convert.ToString(DetailsView1.DataKey.Value);

Get whole html page with values in Code behind.
Hello,  I want to get all HTML code with values entered by user in code behind as it is, Actully this need has arised when I want to send a mail to a given mail id, the whole HTML page as it is (same UI) with entered values.   For this I hv written following code, but it only gives the HTML and not the values user has entered. ------------------------------------------------------------------------------------------------------------------------------------------------------ private...

how to get the dynamically created textbox value in code behind?
Hi all, In my page i've a button('add more'). when i click the 'add more' button it will create 4 textboxes and a delete button.on clicking again another 4 textboxes and a delete button will be created and so on. This work well. What my problem is i cannot get the created textbox's value in the server side.. Here is my code..  <%@ Page Language="VB" MasterPageFile="~/SwapnaMaster.master" AutoEventWireup="false" CodeFile="SwapnaTestPage.aspx.vb" Inherits="SwapnaTestPage" title="Untitled Page" ...

how to get the value of classic textbox inside code behind
Hi! Can anyone help me how can i get the value of classic textbox inside code behind? for instance. <input type="text" id="txtName" value="Curt"> Also, is't posible to iterate the server control? in classic asp..i do it this way <%For i = 0 to 10%> <input type="text" id="txtName<%=i%>" value="<%=i%>"> <%next%> how to do it in server control? using these sample below? <asp:textbox id="txtName" text="" runat="server"/> ...

Can i change the value of html textbox in the code behind page?
In my html page i created a textbox using old input tag: <input type="text" maxLength="12" size="12" name="counter" id="tbutton"> I'd like to change its value from the code behind page. Is it possible? The code below returned an error. It cannot recognize the textbox object. =========================================================================================== Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick tbutton.value = 1 '===> ...

How to get the value of a varibale,created in a Javascript, into a code-behind page?
I am creating a Javascript Like:function GetSelectedTopics() {debugger;  var selectedIds=[];   var TopicIds=document.getElementById("hidTopicList").value.split(",");  for(var i=0;i<TopicIds.length;i++)   {   if(document.getElementById(TOPIC_CHECKBOX_PREFIX+TopicIds[i]).checked)   {      selectedIds[selectedIds.length]=TopicIds[i];  }  } }return selectedIds; } Here I want to get the value of selectedIDs into my code-behind page. I am calling Javascript like: btnCopyTopics.OnClientClick...

i want to get value from code behind in html page using javascipt
  Hai .........   i want to get value from code behind in html page using javascipt i used one usercontrol,,,,,,,,,,, im my ascx page the i placed in one more usercontrols the user controls like as seat type... regarding my application .. the user select the one select one seat.. to set the "dim   lintselectseatcnt as integer =1" this lintselectseatcnt value i want to access the html page... function fun() { var  seatcnt=<%=lintselectseatcnt %> alert(seatcnt); if(seatcnt==0) { alert("please select the seat ") ...

getting textbox value from one page to other page....
Hello Frinds I have a question..  I am entering one userid in the textbox I am getting info from dtabase I am displying.. this userid I am using in other aspx page so i need to use this textbox userid in that page can you tell me any one how i need to get that value from one page to other page.. ASAP thanks.. I believe you can take advantage of QueryString when Passing data from one page to another.   When you redirect to the other page, you can passthe USERID as string to the Url and get that information from there Thanks for your replay Can you give me sample code sir...

Change Value of a Textbox that is inside of a FormView using Vb.Net code behind.
I am having trouble adding text to a textbox that is nested in a form. What I want to do is pre-fill out the insertview form if the user already has their info on file so they don't have to fill out the name, address, etc. each time. Any help will be greatly Hi, You need to define a variables as textbox and assign them to the textbox controls within the FormView by using 'FindControl'. E.g.  Dim MyText As TextBox = CType(FormView1.FindControl("txtMyTextbox"), TextBox) Then you can set the TextBox text value as follows:MyText.Text ="Text you want"  RegardsSmcoxonNo Gem is ever polished without some friction. ((TextBox)FormView1.FindControl("TextBox1")).Text = "test text";Community Coder Thanks smcoxon and iamesqua for the answers. This information was exactly what I was looking for.

Get html code of aspx page from code behind
Hi all, Do you how we can do what I mention in the title?Example: aspx code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Header.aspx.cs" Inherits="Header" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <!--js--> <script type='text/javascript'> alert('hello'); </script> <!--/js-->  Is there any way that in the code behind I can have the above string?. Actually I like to ge...

How to get aliased name of page in master page code behind?
I'd like to access the aliased name generated by the CMS of a page for some logic. UsingRequest.Path.Substring(Request.Path.LastIndexOf("/") + 1)in the master page code behind only gets me the master page name.If that isn't possible, is there something else I can reference that would uniquely identify a particular page from the master page code behind? TobiasUsing VS 2005, C#. Learning on the fly. Hi Temgee, Try refer this code, protected void Page_Load(object sender, EventArgs e) { Response.Write(System.Web.HttpContext.Current.Request.Url.AbsolutePa...

Adding a C# code behind page to a existing project page
I tried to add a .cs file to ab existing project and it seems to be rejecting the .cs code. Is there a declaration i need to include in the .cs file so the compiler knows that the .cs file has c# code and not code? Unfortunately, with this version of VS.NET you can't mix languages, so you'll have to put either one in a component and compile it separately. DonDon Kiely, MCP, MCSDIn the Last Frontier, Interior AlaskaPlease post questions and replies to the forum! And remember to MARK AS ANSWER when someone definitively answers a question or resolves a problem! 2003...

How do you get a reference to the Master page from the code behind of the content page? PLEASE HELP!
Man, I have been messing with this for days. I need to set a string in the Master page from the content page. I can get a reference to the master page SOMETIMES.... and then other, seemingly random (though weighted at 99%) times I can't!!! I have changed the reference manually in the .aspx file, I have experimented with nested master pages and subdirectories, ...I've done everything I can think of several times but intellisense never picks it up and it always gets a red squiggly line. The only time it does seem to work MOST of the time is if both the master page and content page are...

how to access/assign values to variables of aspx code-behind page in javascript code?
Hi, Can anyone help me with this? How to access or assign values to variables of aspx.cs code behind page using javascript code in the aspx page. Will be eagerly waiting for a reply. Thankyou. Raj. here is one way..assign hidden fields to any values you want to get at Page.RegisterHiddenField("fieldName", "fieldValue") then I think in Javascript it would be something like document.forms[0].fieldName.value; to get at it. Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. Luke 11:9 hi Michael, ...

Inline Coding (i.e. no Code-behind) and Wilson Pages (.Net 1.1)
Hi, I'm developing a personal web site and planning on hosting it on Brinkster, but Brinkster does not allow codebehind or using Dlls (from what I understand). But I would still like to use Wilson Master Pages, if possible.  I downloaded the free source code from the Wilson Master Pages website, but I'm not an advanced enough .Net programmer to firgure out how to use the source code using inline code.  Normally, you would use something like:<%@ Register TagPrefix="Wilson" Assembly="WilsonMasterPages" Namespace="Wilson.MasterPages" %>  on your templated pages...

Get value in code behind
How to get value in code behind from source,I assign text value to Label in source file and want to get text of same lable in code behind  file, but i am not able get value in code behind.please give me reply if possible AzharPirana Dargah I assume you mean that in your .aspx or .ascx file you have something like this:<asp:label id='lblTest' runat='server' text='Hello' />And you want to get access to the value in your code file. Assuming this is true you can access the label's properties using its id. For example, above I specified that the lab...

Sorting, Paging in Gridview with Code Behind (Code Behind ONLY!!!)
Does anyone know of a definitive tutorial of VB code-behind for paging and sorting parameters for GridViews?  I've been all over this site and I know more than I need to know about the SortExpression parameter, the ASP.NET tutorials on Paging and Sorting, and the many postings on these forums for same.  Please don't take the copout approach and give me links for what I've already read.  I'm specifically looking for something that gives a detailed explanation for such things as the PageIndexChanging, PageIndexChanged, SelectedIndexChanging, SelectedIndexChanged,...

Setting width for .net controls in code(.aspx) page using function call in code behind..
Hi,  Currently I am trying to set the width of the Table as follows. <asp:Table width="<%=GetWidth()%>" >   and code behind protected Unit GetWidth() { return Unit.Percentage(50); }     It's not working. I know that it works if I set the width complete on some page event(like page_load) of code behind....   Is there a way to maintain the same syntax like calling code behind function in design page...i.e. calling function of .aspx.cs in .aspx page and assign the width as shown above.   Thanks and regards, Giridhar...

Adding dropdowns Programatically To content page in Master Page and retrieving selected value in code behind
HiI have a content page where i need to programatically two pull down. The first one is populated on the server side. The second one is populated on the client upon selecting a value in the first pull down. So far I got this working fine. Then as I do a post back I want to retrive the selected value of the second pulldown (the one populated in the client). Thing is I can find a reference to the control but it is returned empy. No data, no selected value.This page already works outside of master pages. And if I try it with textboxes I can retrieve changes done in the client.Thanks &...

How to change list items in a DDL with values from VB code in code behind with web using master pages?
In the old days using plain asp I used to know how to do this (without the master page of course), but I haven't had need for several years. Since we are using master pages as well, is there a good tutorial or explanation that covers how to pass a list of values from a database query in VB.NET to JScript variables, when master pages are being used? Thanks for any help.     Why would master pages make a difference?  A master page just wraps the page you're working in, so you would still pull the data from the DB the same way.    Let me know if I've misund...

Web resources about - Getting Textbox Value in Page Code Behind - -

ABC/WaPo national poll: Trump’s lead declines, Cruz, Rubio, and Kasich all gain
We’re 12 hours away from knowing whether the “Trump fade” hinted at by last week’s results is real or not, but if you’re looking for poll data ...

Benchmark your hard drives with Microsoft’s open-source Diskspd
Benchmarking your PC’s hard drives is easy, at least in theory. Download some freeware, point it at your hardware, and you’ll have some vaguely ...

Did This Bruce and Kris Jenner Workout Video Haunt Robert Kardashian?
America is getting a fresh look at the relationship between Robert Kardashian and his former wife, Kris Jenner, in “The People vs. O.J. Simpson,” ...

VIDEO: Jay and Dan Unveiled Fake Courtroom Sketches from Hulk Hogan-Gawker Trial
If you are following reporters like Anna Phillips , Tom Kludt , and Keith Harris , and even if you’re not, you’ve realized that the Hulk Hogan ...

Amazon's first live TV program is on fashion
US online giant Amazon on Tuesday announced its first live show for its streaming video service, a 30-minute show dedicated to fashion which ...

US airstrike kills 150 suspected militants in Somalia
Washington Post US airstrike kills 150 suspected militants in Somalia Politico With Louis Nelson, Austin Wright and Ellen Mitchell. WAR REPORT ...

Review: The Samsung S7's camera now rivals the iPhone
It's difficult to justify paying for a high-priced, top-end smartphone these days—unless, that is, you want to take good pictures.

Peyton Manning jokes, chokes up during retirement remarks
ENGLEWOOD, Colo. (AP) — Peyton Manning got through the weekend thanks to hundreds of texts and calls from men he played against or alongside ...

The Latest: Mudslide Blamed for California Train Derailment
A Union Pacific spokesman says a mudslide most likely caused a commuter train derailment in Northern California that sent its leading car plunging ...

Verizon gets tiny FCC fine for secretly tracking subscribers with no way to opt out
How much is your privacy worth to the Federal Communications Commission? Not quite as much as it is undoubtedly worth to you. Back in 2014, it ...

Resources last updated: 3/8/2016 5:17:55 PM