I have a ajax tabcontainer (web-forms not MVC) with different tabs and i have a radio-button list on one of them and when I click on it a value on a different tab needs to change.
Whats the best approach for a trigger here?
Related
I am currently working on a visual studio asp.net website and have a web aspx page with textboxes drop down lists, and a submit button at the bottom of the page. I want the submit button to not function unless all the text boxes are filled and a selection from the drop down menu is made...how can i do this the easiest way possible? I have tried using required field validators and done research still cant seem to achieve this... any help would be great!
I would use for textbox validation Angular and JavaScript which you could integrate with your ASP.NET project. With angular you can use ng-disabled to disabled a button it's very easy.
I have an asp.net MVC app. There is a <button> in a .cshtml file. The button only has an id. There isn't any javascript associated with it. I don't see this button name in any of the controllers.
Yet, when the button is clicked, it doesn't perform an action. How do I trace down what is triggering the button action once it is clicked?
I think you are a little confused on how ASP.NET WebForm and MVC works.
While WebForm is very much similar to WinForms , in a sense that controls can have events that gives it a sense of Stateful appearance, MVC is not the same, it embraces the stateless nature of HTTP.
In MVC when a button is clicked, it is usually associated with a controllerand a action to which it posts the data. So, a button click is translated to action on a control same like method invocation in a WebForm.
Q. The controller still needs to know about the button to handle the click?
there is no existence of control on server side, its the downside (+side from my view) of being stateless. In MVC there is no click, but only method invocation on the controllers.
A same action can be invoked using 10 different buttons. If u can share the code of <view>.cshtml then may be I can help a little bit more.
There could be java script in a separate file. In that JavaScript file there must be click handler attached that must be calling your action in controller via whatever mechanism.
To begin with .. Search in your project where else that button id is used.
That could be the point where you can start tracing...
By virtue of the button being defined within the Html.BeginForm braces, the button click is wired to perform a POST submission with the form data.
I'm new to ASP MVC, and I'm not sure if this is the best solution. I want to display one of two different forms to the user based on what they select from a drop-down. If I was doing this as a regular site, I'd use hidden divs, but I'm not sure if that's the best practice for MVC. Which approach should I use?
It's pretty clear that you need to use javascript in order to achieve this goal. The reason for this that only with javascript's onchange event on the corresponding select element you can plug some custom logic like showing/hiding forms and stuff. So you can have the 2 forms in separate divs and simply toggle their visibility depending on what gets selected in the dropdown. You may include the 2 forms in separate partials and then plug the necessary javascript to toggle their visibility. In general you could use a single form and toggle the visibility of different input fields depending on the user selection. Obviously on the server, when this form gets submitted, you might need to plug the same logic to decide which fields to process because event hidden, the values of the corresponding input fields will be sent to the server.
I'm fairly new to programming and the .net framework, I'm trying to create a registration page that would require users to move from one step to another. There would be a button at the bottom of each page that takes the user to the next page, however is there a way I can do this without haveing to create multiple pages. I've tried creating multiple forms in the asp.net page but i can't add server controls to the other forms as they don't have the attribute "runat='server'".
Please help, how do i go about it?
Several ways you can accomplish this:
Put each section in its own div and use javascript to show/hide each section
Put each section in its own asp:Panel and show/hide each section on postback
Put each section in its own page and capture postback from previous page on the next page
Use the ASP.NET Wizard control: http://msdn.microsoft.com/en-us/library/w7dyf6b5%28v=vs.100%29.ASPX
Using Jquery you can get multiple page form facility.......
https://www.mindstick.com/forum/33822/how-to-use-jquery-steps-form-in-asp-dot-net
I am forced to use Web Forms in my project, and sadly, Web Forms only allow - If I may - "Strict" Websites to be created.
Whenever you need a Button you need to put it in a form, and then you need another button which has nothing to do with the previous button, and you can't have 2 forms,
And the idea of putting a DIV that fires a server side (C#) method is kind of difficult, okay it may be easy but all I have found are "tricks", not an "official" clean way.
So I have this idea of making a webpage for each action in my websites.
For Example:
Let's say I wanna click on the ARROW that raises the rating of this question, I would put something like this.
HTML
Rate Up
And Some CSS Codes to make it look like a beautiful button...
Okay now this will take me to a page called Rating.aspx with 2 parameters, the first parameter is the ID of the question that I would like to raise its rating, and the second parameter is either UP (+rating) or DOWN(-rating).
On the Page Load method of Rating.aspx, I would update the database, then redirect to the question page.
This will work perfectly, BUT, is it a good approach? is it professional? (put in mind that there will be many actions to preform like that...)
With ASP.NET you better use server controls. Better way of implementing that is using or , that actually renders your anchor tag. But you can attach OnClick event handler to this control (link button) so after clicking there would be automatic POST to server. The same page cycle for the current page will take place (this is called PostBack) and your attached event handler will fire, where you can actually make changes to the database. So you don't even need to create any other pages for tasks like this. Every server control has specific set of events like OnClick for buttons or OnSelectedIndexChanged for dropdown lists. You can even create your own controls or derive from existing ones and create your own events.
Take a look on following links for more information:
Button Click
Event Handling in ASP.NET
ASP.NET Page Life Cycle