473,756 Members | 8,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Raise an event from server side control

Can someone tell me how to raise an event or trap when the maxlength of a
server side textbox has been reached?
Nov 19 '05 #1
6 2827
You need to use client-side script to handle the onkeydown, keypress or
onkeyup events. Here's an exmple that handles the events and displays the
key codes - should work on all modern browsers:
http://www.daveandal.net/books/6744/...-mappings.aspx

This example uses the keycodes to create a masked edit control, showing how
you can managet he content of the text box:
http://www.daveandal.net/books/6744/.../maskedit.aspx

"Tim Westmoreland" <Tim We**********@di scussions.micro soft.com> wrote in
message news:E6******** *************** ***********@mic rosoft.com...
Can someone tell me how to raise an event or trap when the maxlength of a
server side textbox has been reached?

Nov 19 '05 #2
What if the textbox is in an editable datagrid and you don't know what the id
is?

"Alex Homer" wrote:
You need to use client-side script to handle the onkeydown, keypress or
onkeyup events. Here's an exmple that handles the events and displays the
key codes - should work on all modern browsers:
http://www.daveandal.net/books/6744/...-mappings.aspx

This example uses the keycodes to create a masked edit control, showing how
you can managet he content of the text box:
http://www.daveandal.net/books/6744/.../maskedit.aspx

"Tim Westmoreland" <Tim We**********@di scussions.micro soft.com> wrote in
message news:E6******** *************** ***********@mic rosoft.com...
Can someone tell me how to raise an event or trap when the maxlength of a
server side textbox has been reached?


Nov 19 '05 #3
I use the trick of creating the client-side function call in ASP.NET in the
ItemDataBound event for each row of a grid, and passing the ID of the
control to the function so it can be located in the client-side script.
You'll have to include the grid control ID as well as the textbox control ID
in the correct combination ("parentID_text boxID").

There's a heap of samples at:
http://www.daveandal.net/books/6744/samples.aspx
that do similar stuff. The Using a Client-side Confirmation Dialog one binds
a client-side event to every button in a Datagrid, and the various User
Control and Server Control examples do the same kind of thing with a number
of parameters passed to the client-side code to locate controls in the page
in the client-side code. You can download all the samples from:
http://www.daveandal.net/books/6744/

"Tim Westmoreland" <Ti************ *@discussions.m icrosoft.com> wrote in
message news:D6******** *************** ***********@mic rosoft.com...
What if the textbox is in an editable datagrid and you don't know what the id is?

"Alex Homer" wrote:
You need to use client-side script to handle the onkeydown, keypress or
onkeyup events. Here's an exmple that handles the events and displays the key codes - should work on all modern browsers:
http://www.daveandal.net/books/6744/...-mappings.aspx

This example uses the keycodes to create a masked edit control, showing how you can managet he content of the text box:
http://www.daveandal.net/books/6744/.../maskedit.aspx

"Tim Westmoreland" <Tim We**********@di scussions.micro soft.com> wrote in
message news:E6******** *************** ***********@mic rosoft.com...
Can someone tell me how to raise an event or trap when the maxlength of a server side textbox has been reached?


Nov 19 '05 #4
Thanks a lot. You've been a big help.

"Alex Homer" wrote:
I use the trick of creating the client-side function call in ASP.NET in the
ItemDataBound event for each row of a grid, and passing the ID of the
control to the function so it can be located in the client-side script.
You'll have to include the grid control ID as well as the textbox control ID
in the correct combination ("parentID_text boxID").

There's a heap of samples at:
http://www.daveandal.net/books/6744/samples.aspx
that do similar stuff. The Using a Client-side Confirmation Dialog one binds
a client-side event to every button in a Datagrid, and the various User
Control and Server Control examples do the same kind of thing with a number
of parameters passed to the client-side code to locate controls in the page
in the client-side code. You can download all the samples from:
http://www.daveandal.net/books/6744/

"Tim Westmoreland" <Ti************ *@discussions.m icrosoft.com> wrote in
message news:D6******** *************** ***********@mic rosoft.com...
What if the textbox is in an editable datagrid and you don't know what the

id
is?

"Alex Homer" wrote:
You need to use client-side script to handle the onkeydown, keypress or
onkeyup events. Here's an exmple that handles the events and displays the key codes - should work on all modern browsers:
http://www.daveandal.net/books/6744/...-mappings.aspx

This example uses the keycodes to create a masked edit control, showing how you can managet he content of the text box:
http://www.daveandal.net/books/6744/.../maskedit.aspx

"Tim Westmoreland" <Tim We**********@di scussions.micro soft.com> wrote in
message news:E6******** *************** ***********@mic rosoft.com...
> Can someone tell me how to raise an event or trap when the maxlength of a > server side textbox has been reached?


Nov 19 '05 #5
if you set a the 'MaxLength' for a text it will not allow you to type text
longer than the 'MaxLength'

HTH

Ollie Riches

"Tim Westmoreland" <Ti************ *@discussions.m icrosoft.com> wrote in
message news:17******** *************** ***********@mic rosoft.com...
Thanks a lot. You've been a big help.

"Alex Homer" wrote:
I use the trick of creating the client-side function call in ASP.NET in the ItemDataBound event for each row of a grid, and passing the ID of the
control to the function so it can be located in the client-side script.
You'll have to include the grid control ID as well as the textbox control ID in the correct combination ("parentID_text boxID").

There's a heap of samples at:
http://www.daveandal.net/books/6744/samples.aspx
that do similar stuff. The Using a Client-side Confirmation Dialog one binds a client-side event to every button in a Datagrid, and the various User
Control and Server Control examples do the same kind of thing with a number of parameters passed to the client-side code to locate controls in the page in the client-side code. You can download all the samples from:
http://www.daveandal.net/books/6744/

"Tim Westmoreland" <Ti************ *@discussions.m icrosoft.com> wrote in
message news:D6******** *************** ***********@mic rosoft.com...
What if the textbox is in an editable datagrid and you don't know what the
id
is?

"Alex Homer" wrote:

> You need to use client-side script to handle the onkeydown, keypress
or > onkeyup events. Here's an exmple that handles the events and displays the
> key codes - should work on all modern browsers:
> http://www.daveandal.net/books/6744/...-mappings.aspx
>
> This example uses the keycodes to create a masked edit control,
showing how
> you can managet he content of the text box:
> http://www.daveandal.net/books/6744/.../maskedit.aspx
>
> "Tim Westmoreland" <Tim We**********@di scussions.micro soft.com>
wrote in > message news:E6******** *************** ***********@mic rosoft.com...
> > Can someone tell me how to raise an event or trap when the

maxlength of a
> > server side textbox has been reached?
>
>
>


Nov 19 '05 #6

use RegisterClientS criptBlock:

RegisterClientS criptBlock("cli entScript", "<script
language=JavaSc ript>alert('Hel lo ');</script>");
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10522
by: Dan Cimpoiesu | last post by:
I have a remoting object, derived from MarshalByRefComponent, that I instantiate on the client side, with Activator.GetObject. Can I receive events fired on the server, on the client? How?
2
1916
by: Andrew | last post by:
Hi, friends, I need to raise certain events in my VC# windows control library. Any reference paper or sample source code for help? Thanks a lot...
2
4020
by: Oney | last post by:
I want to open a popup window when user click the web server button control When user click the button, only OnClik="OpenWindow(12)" is sent but no event happend no popup opened.After that, user click again popup window is open. So user must click twice! So I must raise event twice. How can I do that or do you advice any solution? Thanks!
19
2484
by: Sjaakie Helderhorst | last post by:
Hello, I need to add a Javascript event (onClick) to a servercontrol (asp:checkbox). Checkbox is named 'cbDoMail'. Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()") would do the job, unfortunately it didn't. Can anyone point me in the right direction? Thanks!
4
4481
by: Barb | last post by:
I have a user control as my Save button for my page. When the Save button is clicked, I want some client-side validation to take place from a javascript function in the page, and then I'd like the server event to fire to update the database. I've successfully done this with a normal webcontrol via: myControl.Attributes("onclick") = "javascript:alert('You clicked me!!');" In that case, myControl is an asp:button on the page. In the...
2
4375
by: The Crow | last post by:
i want to raise an event on the server with a javascript call on the client. i found a solution but i think its not so elegant. the solution is: i call __doPostBack("RefreshPage", ""); from javascript and check in the Page_Load routine : bool refreshPage = Request.Form == "RefreshPage"; i could do it with __doPostBack("", "RefreshPage"); and == "RefreshPage" i could also add a hidden input control to the form, and set its value to
0
2955
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it such as when they do a delete. Everything is great. By and large it will be used in my repeater controls using the command event when the user clicks on it and so that event is working great. My issue is the Click event. When the control is...
5
13962
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox I want to use a hidden button to fire when the Onclick Event is fired for the TextBox.
2
3929
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.