Help to look for Control

Discussion in 'ASP .Net Web Controls' started by PABLIN, Aug 7, 2003.

  1. PABLIN

    PABLIN Guest

    Hello Friends, I need to look for a control can be Web
    Form or Html Form, by means of the TabIndex property, how
    I can do it?
    PABLIN, Aug 7, 2003
    #1
    1. Advertising

  2. PABLIN

    Alvin Bruney Guest

    all controls on a form are part of the form controls collection. loop thru
    that looking for the form's id as an identifier.

    "PABLIN" <> wrote in message
    news:030601c35d16$8e1fd3a0$...
    > Hello Friends, I need to look for a control can be Web
    > Form or Html Form, by means of the TabIndex property, how
    > I can do it?
    Alvin Bruney, Aug 8, 2003
    #2
    1. Advertising

  3. Assuming you are using the tabindex property, you can loop through the controls
    on the form using server-side code to pick out the control's tabindex and set
    other values.

    Here's a little demo:

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim cntrl As Control
    Dim txtcntrl As TextBox
    For Each cntrl In Page.Controls(1).Controls
    If TypeOf cntrl Is System.Web.UI.WebControls.TextBox Then
    txtcntrl = cntrl
    If txtcntrl.TabIndex = 1 Then
    Button1.Text = "The Textbox is tabindex " & _
    txtcntrl.TabIndex.ToString
    End If
    End If
    Next
    End Sub


    <form id="Form1" method="post" runat="server">
    <p>
    <asp:button id="Button1" tabindex="5" runat="server"
    text="Button"></asp:button></p>
    <p>
    <asp:checkbox id="CheckBox1" tabindex="2"
    runat="server"></asp:checkbox></p>
    <p>
    <asp:textbox id="TextBox1" tabindex="1"
    runat="server"></asp:textbox></p>
    <p>
    <asp:imagebutton id="ImageButton1" tabindex="9" runat="server"
    imageurl="http://www.gc.ca/images/rollingflag.jpg"></asp:imagebutton></p>
    </form>


    Does this help?

    Ken
    MVP [ASP.NET]


    "PABLIN" <> wrote in message
    news:030601c35d16$8e1fd3a0$...
    Hello Friends, I need to look for a control can be Web
    Form or Html Form, by means of the TabIndex property, how
    I can do it?
    Ken Cox [Microsoft MVP], Aug 8, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe

    Look for Property Grid Control

    Joe, Jan 13, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    678
    Curt_C [MVP]
    Jan 14, 2004
  2. Marina
    Replies:
    3
    Views:
    382
    Marina
    Jan 28, 2004
  3. =?Utf-8?B?U2hlbGw=?=

    How to give 3d Look to Datagrid and WebParts control?

    =?Utf-8?B?U2hlbGw=?=, Oct 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    540
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Oct 28, 2005
  4. inhahe
    Replies:
    3
    Views:
    2,311
    Diez B. Roggisch
    Jan 28, 2005
  5. Replies:
    4
    Views:
    156
Loading...

Share This Page