Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make the button a defaultbutton 1

Status
Not open for further replies.

yosie2007

Technical User
Jun 23, 2007
46
US
I would like both the text box to get focous and click button to get the defaultbutton but I do not have the <form id="form1" runat="server" >on because I have master page. How can this be acomplished? thanks
 
Both button and texbox located on the content page.
 
Just set them on the Page Load event then e.g.
Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        TextBox1.Focus()
        Page.Form.DefaultButton = Button1.UniqueID
    End Sub


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Thank you Mark for your help. I add this on the page load event and the text focous is working but the default button is not working yet

tabSearch is the id for the button...I am not sure where Button1 is.

thanks
txtDescription.Focus()
Page.Form.DefaultButton = Button1.tabSearch

 
Thank you for your help. I am still confused though I am only able to see the id for Button which is tabSearch but not the name for the button. I am working with vs 2005. thanks Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top