locked
Discussion about Textboxes: ASP.NET (Razor) Vs VB.NET RRS feed

  • Question

  • User-1549556126 posted

    Would like to open this forum topic for those who are transitioning from WinForms to WebPages specifically when Razor pages are becoming a commonly used syntax specially in Blazor. There used to be several features in Winforms which were quite handy to manage values like strings & IDs in the textboxes. For example: When I needed to store the ID value in a textbox of a winforms which is supposed to display key or string value. So, I used to store that ID in the tag property. 

    textbox1.text = "Name";
    textbox1.tag = "1";

    Similarly, there is a property of acceptbutton which can allow me to increase the count of tabindex which I used when I wanted to switch the focus from one textbox to other by pressing the Enter key press. Is it possible to do such things in Razor using the least amount of code or by no code at all? Any tips and tricks that we should keep in mind for efficient programming?

    Thursday, March 26, 2020 6:35 PM

Answers

  • User475983607 posted

    Your question is not easy to answer because web applications are very different from WinForms.  Web applications are a single instance of the application accessed by many users through a browser where the interactions are stateless.  A WinForms application is accessed by one user and is statefull.  This is generally a tough concept to understand when moving from WinForms to Web Applications.  

    In every web application the developer must solve the problem of maintaining state.   Also all the interactions are through a browser and HTTP.

    vyasnikul

    Similarly, there is a property of acceptbutton which can allow me to increase the count of tabindex which I used when I wanted to switch the focus from one textbox to other by pressing the Enter key press. Is it possible to do such things in Razor using the least amount of code or by no code at all? Any tips and tricks that we should keep in mind for efficient programming?

    Sure.  The UI in browser based applications is HTML.  HTML inputs have a tab index attribute.  

    https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

    Keep in mind, the default behavior of the enter key in a browser is submitting an HTML form.  IMHO, the best it is best to learn HTML/CSS and HTTP GET and HTTP POST. 

    https://www.w3schools.com/tags/ref_httpmethods.asp

    https://www.w3schools.com/tags/ref_httpmethods.asp

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 26, 2020 7:12 PM