Skip to main content

Set focus to a control from code behind, ASP.NET!

I tried to focus on error message in a control (asp.net table) but I couldn't get it. So I added a hyperlink control next to the table and set focus on it. It worked perfectly.

What I did:

  • Add the following code in aspx.
     <asp:HyperLink ID="LnkFocus" runat="server">
     </asp:HyperLink>
  • Add this in code behind
     LnkFocus.Focus();

That's all. I think this is one of the easiest way to set focus on a control.

Comments

Popular posts from this blog

WhatsApp Text Formatting!

WhatsApp rolls out text formatting options including bold , italic , strike-through and combinations of these in messages. It can be done as below. Bold using asterisk: *bold text* Italic using underscore: _italic text_ Strike-through  using tilde: ~strikethrough text~ Combination for bold and italic : *_bold italic_* Thank you!

How to run and read traceroute test in Windows, Networking!

Traceroute is a network utility program to trace the path from one network to another. It displays response times that occur at each stop (hops) along the route. We can know if there is any connectivity issue or latency connecting to a target. The stops having issue can be identified by looking into the report generated by traceroute. Command: tracert hostname hostname - Name of the destination server that is traced Example: Reading the traceoute test results: There are 6 rows. Each row represents a hop. Route can be traced up to maximum of 30 hops. There are 5 columns in each row. Hop# - No. of hops that packets are traveled RTT (Rount Trip Time) Columns - Time taken by packets to communicate with the host (both way). Three separate packets are sent. It helps to check consistency or a lack in the route. Domain/IP Address - IP address of the router. Domain name is displayed if it's available The data of RTT columns are important to check if there are fa