how to get textbox value in javascript??

i have textbox in datagrid n want to acess tht value in javascript.........hw iwll do tht?


<asp:TextBox ID="txtbxEndDate" runat="server" Style="width: 70px"></asp:TextBox>

<asp:ImageButton ID="imgEndDt" runat="server" TabIndex="9" Height="21px" ImageUrl="../Images/calecder.jpg"

AlternateText="SelectDate" OnClientClick="return false;" />

<ajaxToolkit:CalendarExtender ID="clndrEndDt" runat="server" Format="MM/dd/yyyy"

TargetControlID="txtbxEndDate" PopupButtonID="imgEndDt">



9/10/2008 10:27:19 AM 24353 articles. 1 followers. Follow

10 Replies

Similar Articles

[PageSpeed] 41



will give you the text in text box.

~ Remember To Mark The Posts Which Helped You As The ANSWER ~
9/10/2008 10:34:17 AM


Please refer the below link :



Hope this wil help you


9/10/2008 10:53:07 AM

 Try this in javascript

function txtValue()


var str=document.getElementById('txtbxEndDate.ClientID).Value;






9/10/2008 11:19:40 AM

 Try this:

function GetGridID()

    return <%= "'" + Gridview1.ClientID + "'" %>

function GetTextBox(rowIndex)

     var i;

    if(rowIndex < 10) i = '0' + rowIndex;

    else i = rowIndex;
    return document.getElementById(GetGridID() + '_crl' + i + '_txtbxEndDate';

9/10/2008 12:21:43 PM

You need to attach client-side event handlers in the ItemDataBound event of the DataGrid

aspx file:

<asp:datagrid id="DataGrid1" autogeneratecolumns="False" runat="server" OnItemDataBound="DataGrid1_ItemDataBound" ...

<script type="text/javascript">
function getGridTextBoxValue(textBoxId)
// -->

aspx.cs file:

protected void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 if ( e.Item.ItemIndex >= 0 )
  TextBox gridTextBox = (TextBox)e.Item.FindControl("txtbxEndDate");
  ImageButton gridImageButton = (ImageButton)e.Item.FindControl("imgEndDt");

  if ( (gridTextBox != null) && (gridImageButton != null) )
   //gridTextBox.Attributes.Add("onchange", "alert('value = ' + this.value);");

   string clickHandler = string.Format("getGridTextBoxValue('{0}');", gridTextBox.ClientID);
   gridImageButton.Attributes.Add("onclick", clickHandler);


9/10/2008 12:40:53 PM

hey thanx a lot for ur rly..........

9/10/2008 5:11:43 PM

Make sure that you mark the post that helped you "ANSWER".



9/10/2008 5:18:14 PM

ya ur ans is very helpful for me  but some prob is there for month n day validation...

actually in date textbox it will take date as.....09/07/2008(dd/MM/yyyy)

if ( (monthValue < 1) || (monthValue > 12) )....u told me write this .......... month  between 1 to 12 but textbox take it as 01,02,03 and so on...

so i hv to change condition.....can u help me in tht?

9/11/2008 4:26:24 AM

Use d/m/yyyy instead of dd/MM/yyyy while formating Days

9/11/2008 8:39:43 AM

I also told you to use:
     var dayValue = parseInt(valueArray[0]);
     var monthValue = parseInt(valueArray[1]);
     var yearValue = parseInt(valueArray[2]);

Use parseFloat instead of parseInt
     var dayValue = parseFloat(valueArray[0]);
     var monthValue = parseFloat(valueArray[1]);
     var yearValue = parseFloat(valueArray[2]);

Which will remove the '0'


9/11/2008 3:10:34 PM

Similar Artilces:

Get textbox value in client side
My problem is that in my ascx file i have a textbox & a input buttom with a javascript function that will validate the textbox: .... <script lang="javascript"> function Test() { if (document.all.txt1.value == "") { alert(); return; } } </script> .... <asp:textbox id="txt1" runat="Server"></textbox> <input type=button id="cmd1" onclick="javascript:Test();" value="Add"> .... But the function don't work, because the textbox control isn't...

Getting Value from Client-side InputBox to .net variable
hi, im doing a login page for our timekeeping. Since there's no msgbox available on, im doing it dynamically via javascript. How do i Get the value frm a dynamically written javascript (such as inputbox) to a .net variable? here's the logic of my program, user logs in hits the button and sub-routine Login will be fired, if user is late -- call Check_Late Sub, this is whre the client-side script was built -- then after that i wanted to be able to get the value from an inputbox. '// if button login clicked Sub Login(Sender As Object, E As EventArgs) .......

Getting Textbox Watermark Text in client side javascript
Can somebody tell me how I can go about grabbing the Text value of a TextBoxWatermark control from client side javascript?  I need to make a comparison/validation if a text box has been filled out (non-blank) and of course the watermark fills in the text value of the text box when grabbing the property (of the text box) per javascript? So, I need to somehow grab the text from the watermark in javascript and then compare to the text box contents to see if the text in the textbox is the water mark text or not.  Any information would be greatly appreciated.  Thanks!  Th...

Get values set by javascript to .net enabled textbox
I have a bit of javasript that writes a value to a text box.  The text box is read only. Textbox code:<input type="text" id="txtColor1" runat="server" readonly="readonly" size="6" /> Snippet from javascript functioncolorBox = document.getElementById('<%= txtColor1.ClientID %>');colorBox.value = colorCode;  Code behind:string color1 = txtColor1.Value Whenever I attempt to get the value out of the text box after it has been changed by the javascript, it always reverts back to the old data and not the new. Anyo...

Get the Dropdownlist text and value using Javascript from client side
Hi, I am encountering a problem about how to get the Dropdownlist text and value using Javascript from client side. I am using C# in Visual Studio 2005 and Javasript . The example codes are like: ( In this example code, I would like to access the text and value of the DropDownListReports in the run() function of Javascript. How can I do that? Any ideas? Thanks a lot. ) protected void Page_Load(object sender, EventArgs e) {              if (!Page.IsPostBack)            &nb...

how to get value from client side script Prompt window to a session var in .net
hi guyz, i hav a problem with getting a value from a client-side inputbox to a session var in .net. is this possible? however, when i click submit button this is the code that's triggered. dim sb as New System.Text.StringBuilder sb.append("<script language=" & """" & "vbscript" & """" & ">") sb.append(vbcrlf) sb.append(vbcrlf) sb.append("do while xLate =" & """" & """") sb.append(vbcrlf) '//prompt window, val...

How to get the value from a textbox of a datagrid template column while in edit mode using client javascript
Hi, I have added a template column to my datagrid, and in EditItemTemplate tags i am displaying an asp textbox <EditItemTemplate> <asp:TEXTBOX id=TextBox1 Text='<%# Container.DataItem("MyDataField) %>' Runat="server"></asp:TEXTBOX> </EditItemTemplate> i need to get the value of the textbox using a client side scripting language like Javascript. i tried the document.forms[0].TextBox1.value option but does not work I need a solution for this Waiting for replies. i'm trying to figure out the same thing, my current m...

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

repeater with textboxes. how to read the textbox values on client side
Hi  I have a data bounded repeater with text boxes attached. How can I read the values of the textboxes using javascript?? Could not find a proper link.. Appreciate any solution , thanks     The repeater will add a prefix to each textboxes ID to ensure uniqueness.  The following function will loop through all textboxes of the repeater, and if the ID of the given textbox contains the string specified, the it will consider it a match and you can access it's value property easily.  Here is the function: function textboxFinder() { var repeater =...

pass client textbox value to a server side textbox
HiDoes anyone know how in javascript to pass a client side textbox value to a server side textbox?Thanks in advance.Graham. An asp textbox is a resular textbox. so you do it the same way.document.formName.elementName.value = document.formName.elementName2.value;One thing to note is that the asp textbox is going to have a slightly different name then what you named | Twitter epascarello | LinkedIn...

Getting value from a textbox control that was filled with a value from javascript
 I have a textbox control (seen below txtMileageDollars1) that gets filled with javascript based on the number of miles a user types into another textbox (txtMileageMiles1) control.  When I post back with the submit button, the value is blank.  I've tried setting EnableViewState to false, but still cannot get a value on postback.  Does anyone have a solution?   Miles<asp:TextBox ID="txtMileageMiles1" runat="server" Width="50px"></asp:TextBox>   Total (txtMileageMiles1 * rate with javascript)<asp:TextBox...

How to Encrypt the value of textbox in client side and Decrypt it in server side?
How to Encrypt the value of textbox in client side and Decrypt it in server side? THere is no use in decrypting ur content @ client side since a normal user can view the decrytion logic when he takes 'view source' option 'SSL' technology is used in this situations. SreejithSreejith Sreejith: he did not ask to decrypt it on client-side! Take a loot at this article on the Cryptography application block: Stodola ← Come check out my blog! Another good article:

Getting hidden variable value from server side in client side
hi,        I am struck in problem. I have a hidden field in my form and i am setting some value in that.         Now i wnt to use this value from client side but i m not able to retrieve it. All i am getting there is an object.         I feel the hidden field is not able to hold that value.         <input type="hidden" id="hdnVar" runat="server" />         in code behind      ...

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

Problem accessing server side array values from javascript client side function
i faced the following problem ..i have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>; First of all, you can't mix server-side and client-side code. The reason is that the protocol that is used to communicate betwee...

Web resources about - how to get textbox value in javascript?? -

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

JavaScript - Wikipedia, the free encyclopedia
programming styles. JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
... editor - report abuse/spam - help the entire directory only in Tools/Obfuscators Description Top : Computers : Programming : Languages : JavaScript ...

Facebook Open-Sources JavaScript Static-Type Checker Flow
The latest software to be open-sourced by Facebook is Flow , a static-type checker for JavaScript . (more…) New Career Opportunities Daily: ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

The Facebook SDK for JavaScript provides a rich set of client-side functionality for adding Social Plugins, making API calls and implementing ...

Facebook App Devs Get Javascript
It has been an oft-lamented fact of the Facebook Platform thus far in its life that, in order to use all but the most simple of Javascript functionality–the ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken .… ...

Resources last updated: 1/1/2016 2:16:53 PM