• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

Div or Input into TextBox

I have already the solution to get client time here .

My next problem that I need to get help is how to populate of either value into aspx TextBox using VB.Net or C#:

$('div#result').text(theFullDate);
$('input#time').val(theFullDate);


Many Thanks.
0
JimiJ13
Asked:
JimiJ13
  • 2
2 Solutions
 
Gregory MillerGeneral ManagerCommented:
The DIV reference will put the value between the <div></div> tags with the id='name'

The INPUT reference will insert the value into the textbox with the name='time'

Not exactly certain what your question is.
0
 
Scott Fell, EE MVEDeveloperCommented:
I am not a  .net developer, however, your serverside code runs first on the server, then the html renders, then javascript/jquery is run.   This might happen fast enough that you can't tell the difference, but if you ran it in slow motion you would see a big difference.

All you need to do is to label your form control so it renders with at least a name or id.  What counts is how the control renders.


If your form control renders as <input id="date" name="date"> then your jquery would be $('input#date').val(theFullDate);   Or if you want to use name, $("input[name='date']").val(theFullDate);
0
 
JimiJ13I T ConsultantAuthor Commented:
Hello Padas/Technodweeb,

Now I know why I can't pick up the value because my TextBox name changes when rendered in html like:
INPUT#ctl00_PageContent_myTimeTextBox instead of INPUT#myTimeTextBox

The only issue I at the moment am that, it cannot work inside the Ajax Update Panel.


Thanks.
0
 
JimiJ13I T ConsultantAuthor Commented:
Thanks you guys for the enlightenment.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now