473,569 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default button inside a custom control

KJ
I have seen examples on how to set the default button on a ASPX page
with asp server controls

Sub Page_Load()

Page.RegisterHi ddenField("__EV ENTTARGET", "btnSearch" )

End Sub

But that does not work if your default button is inside a custom
control on a ASP.NET page. If someone think is does let me know what
I'm doing wrong.

Are they any way I can make that work?

Thanks in advance
Nov 17 '05 #1
3 3228
Try modifying your code like this to make sure you're getting the full
correct client side control id at run time:
Page.RegisterHi ddenField("__EV ENTTARGET", btnSearch.Clien tID)

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"KJ" <kl******@hotma il.com> wrote in message
news:d8******** *************** ***@posting.goo gle.com...
I have seen examples on how to set the default button on a ASPX page
with asp server controls

Sub Page_Load()

Page.RegisterHi ddenField("__EV ENTTARGET", "btnSearch" )

End Sub

But that does not work if your default button is inside a custom
control on a ASP.NET page. If someone think is does let me know what
I'm doing wrong.

Are they any way I can make that work?

Thanks in advance

Nov 17 '05 #2
KJ,

I've use this script to set my default buttons from a text box. With a
little modification it would work from other objects if you aren't using it
from a text box.

TextBox.Attribu tes.Add("onkeyd own", "javascript:if( (event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.F orm1." & Button.ClientID & ".click();retur n false;}else
return true;")

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"KJ" <kl******@hotma il.com> wrote in message
news:d8******** *************** ***@posting.goo gle.com...
That did not work. Any other suggestions?

Nov 17 '05 #3
KJ
Thanks
Nov 17 '05 #4

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

Similar topics

5
6720
by: Vern | last post by:
I'd like the default text to show up in designer, and allow it to be changed to something else. I was able to change some of the other properties, but for some reason I'm having trouble with the text. Here's the code from my latest attempt. I initially tried just setting this.Text = "E&xit" but that didn't work. Any ideas? public class...
0
1247
by: sonic | last post by:
hello, I have this custom datagrid control, that inherits from DataGrid. In addition to datagrid, I am adding a "status" table under it, and another html button, which will trigger a new row. My problem is that the events associated with the custom button do not trigger every time. I am adding my button as private global control inside...
1
2616
by: Martin | last post by:
Hi, I have produced a custom server control that simple outputs a row of 26 buttons, one button for each letter of the english alphabet. now what I would like to do is catch the button click inside the server control when it is clicked on. however when I click on a button at present I get an error saying that the An error has occurred...
1
1487
by: Fabuloussites | last post by:
I have a master page that has a button on it that is included on all of it's child pages. On one of the chile pages, there is a login control. I would like to have the login control become the default button when that page is in use. Currently, if a user tries to log in, when they press the enter key, the forms defaults to the actions of...
1
1499
by: tranky | last post by:
Hi boys.. ....i've a question for you! I've a custom control with a button. Well... I need to create that: <mytagprefix:mytag runat="server" onButtonClick="Button_Click"> And in the code behind of this page, i find the Button_Click function.
1
2162
by: JJ | last post by:
What trouble I'm having setting default buttons on a page (with a master page). I got around doing it on a page basis by calling the SetWizardDefaultButton() routine from page load. Notice how messy it looks because I could not find the required button any other way but by using the id it is given in the source code. I tried every...
1
1948
by: shapper | last post by:
Hello, I am creating a custom control where I have a button. Somehow my button click event is not being raised. I tried to place different codes inside MyButton_Click and nothing runs. Then I added Context.Response.Redirect("http://www.google.com"). When I click the button postback is done but the page google is not called.
17
10310
by: govolsbaby | last post by:
Is there a way to leave the button forecolor unchanged when it is disabled? I have multiple buttons on the form and depending on various user inputs, some will or will not be enabled but I'd rather their text not go to gray. Thanks.
0
7703
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...
0
7618
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...
0
7926
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. ...
0
8132
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
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...
1
5514
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...
0
3656
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.