Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:54:31+00:00 2026-05-10T16:54:31+00:00

I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>

  • 0

I have three TextBox controls on the page

<asp:TextBox ID='TextBox1' runat='server' AutoPostBack='True'         OnTextChanged='TextBox_TextChanged' TabIndex='1'> <asp:TextBox ID='TextBox2' runat='server' AutoPostBack='True'         OnTextChanged='TextBox_TextChanged' TabIndex='2'> <asp:TextBox ID='TextBox3' runat='server' AutoPostBack='True'         OnTextChanged='TextBox_TextChanged' TabIndex='3'> 

and an event handler

protected void TextBox_TextChanged(object sender, EventArgs e) {     WebControl changed_control = (WebControl)sender;      var next_controls = from WebControl control in changed_control.Parent.Controls                         where control.TabIndex > changed_control.TabIndex                         orderby control.TabIndex                         select control;      next_controls.DefaultIfEmpty(changed_control).First().Focus(); } 

The meaning of this code is to automatically select TextBox with next TabIndex after page post back (see Little JB’s problem). In reality I receive InvalidCastException because it’s impossible to cast from System.Web.UI.LiteralControl (WebControl.Controls contains actually LiteralControls) to System.Web.UI.WebControls.WebControl.

I am interested is it possible to modify this aproach somehow to receive working solution? Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:54:32+00:00Added an answer on May 10, 2026 at 4:54 pm

    OfType

    from control in changed_control   .Parent   .Controls   .OfType<WebControl>() 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables: page, attachment, page-attachment I have data like this: page ID
I have three tables tag , page , pagetag With the data below page
I have a asp.net page content as below. There is an HtmlInputText control inside
Is there anyway in XAML only to have a linebreak in a TextBox? I
I have three models: class ReleaseItem < ActiveRecord::Base has_many :pack_release_items has_one :pack, :through =>
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have three (C++) classes: Player, Hand, and Card. Player has a member, hand,
I have three divs : <div id=login /> <div id=content /> <div id=menu />
I have three tables in the many-to-many format. I.e, table A, B, and AB
I have three values I need to align in a dropdown box. How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.