473,508 Members | 4,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

postback via java for TextBox

2 New Member
hi,

i need to be able to find out when the user changes a date, which is displayed in a textbox using a CalendarExtender.
because the CalendarExtender only allows client side (java) calls and does not call a function in code behind, i have to somehow find a way to do this using java.
i would like to use the OnTextChanged event of the textBox if possible.
i have got most of the code, but i do not know how to retrieve the targetID object of the CalendarExtender.
i must admit, my java knowledge is not the best and i can not find any info on it.

here the code


<script type="text/javascript">
function UpdateClientDate(cal)
{
__doPostBack(>>>textBoxObj<<<,'test');
// textBoxObj is supposed to be the TargetControlID of CalendarExtender1
// obj of CalendarExtender1 should be the parameter cal, right ?
}
</script>

...
<asp:TextBox ID="IDE_DATE_FROM" runat="server" Width="75px" OnTextChanged="IDE_DATE_FROM_TextChanged"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MMM/yyyy" OnClientDateSelectionChanged="UpdateClientDate" TargetControlID="IDE_DATE_FROM" />
...


code behind

protected void IDE_DATE_FROM_TextChanged( object sender, EventArgs e )
{
}


any help would be appreciated

cheers
Martin
Mar 22 '07 #1
2 8174
aussie1968
2 New Member
__doPostback might not be the right way to go if i want to use an event ;)
the follwing function should be more suitable, but i still need to retrieve the obj of the textBox.

function FireEvent(el, ev)
{
var localE = document.createEvent("HTMLEvents");

localE.initEvent(ev.substring(2, ev.length), true, true);
el.dispatchEvent(localE);
}

since i am using this in a gridView with a dynamic amount of rows, i guess i can
not use the follwing either.

$get('ctl00_ContentPlaceHolder2_IDE_DATE_FROM');

cheers
Martin
Mar 22 '07 #2
jmRFr
1 New Member
hi,

i need to be able to find out when the user changes a date, which is displayed in a textbox using a CalendarExtender.
because the CalendarExtender only allows client side (java) calls and does not call a function in code behind, i have to somehow find a way to do this using java.
i would like to use the OnTextChanged event of the textBox if possible.
i have got most of the code, but i do not know how to retrieve the targetID object of the CalendarExtender.
i must admit, my java knowledge is not the best and i can not find any info on it.

here the code


<script type="text/javascript">
function UpdateClientDate(cal)
{
__doPostBack(>>>textBoxObj<<<,'test');
// textBoxObj is supposed to be the TargetControlID of CalendarExtender1
// obj of CalendarExtender1 should be the parameter cal, right ?
}
</script>

...
<asp:TextBox ID="IDE_DATE_FROM" runat="server" Width="75px" OnTextChanged="IDE_DATE_FROM_TextChanged"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MMM/yyyy" OnClientDateSelectionChanged="UpdateClientDate" TargetControlID="IDE_DATE_FROM" />
...


code behind

protected void IDE_DATE_FROM_TextChanged( object sender, EventArgs e )
{
}


any help would be appreciated

cheers
Martin
Martin,

You may call

Expand|Select|Wrap|Line Numbers
  1. document.getElementById(<%=IDE_DATE_FROM.Idclient%>)
Regards
Jun 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
879
by: Karthik | last post by:
I have two textboxes on a web form. The second textbox is set to readonly. I do a postback after a value is entered in the first textbox and I set the second textbox readonly property to false in...
3
3875
by: Igor Belagorudsky | last post by:
Hi, i am trying to analyze data submitted in a form but the problem is that when i try to create the controls in code (which is what i want to do), it throws an obect not found exception on...
10
4478
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
0
942
by: bill yeager | last post by:
I have a simple button and textbox on a webform with a RequiredFieldValidator tied to the textbox control. The problem is that a postback never occurs on the webform by clicking the button even...
8
11137
by: walesboy | last post by:
greetings - I have a btnSubmit button with a Handles btnSubmit.click which works great if all the user does is click that button. But, if the user ALSO changes a text box on the page (which...
2
8288
by: Antoine | last post by:
Hi I want to avoid postback on a calendar. I have a .NET calendar control in asp.net. Ideally I would like to remove any indication of the postback fore/back months. It sucks. I would like to...
11
14789
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
3999
by: paulcis | last post by:
I am trying to produce a dynamic form from a database with unknown amount of records. I need to read the values and create a new textbox for each. I need to create the textboxes at page_init stage...
4
5346
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.