Is there a cleaner way to pull a lot of data from a form for calculations?
I feel like I have a lotta ugly tryparse stuff going on. Do people just pull it in one go?
I have like 40 controls a user can change (trust me, it can't be helped) and on recalc its a lot of pull, calculate, put back. Seems horribly messy.
I have a fairly complex form with the same problem. I have 2 routines, one to map the screen to internal values and another to map the internal values to the screen. Ugly. Yes; but it works and it is straight forward.
Web programs do not run like windows programs, you have to change the way you think in designing your program mechanics. Shifting over to the client side would more closely mimic a windows program.
You can start by optimizing your program to run faster on the server side, get rid of the bloat first. Perhaps ask a small optimization question next.
Here's my dilemma. I want all the goodness of controllers, I want strongly typed views and model binding - basically all the best bits of MVC. However, even a fairly simple page will usually require some client side script for showing\hiding elements, confirmation boxes & all that funky stuff that users expect for todays interactive web pages. You normally end up with 'page specific script' which will be a number of event handlers and bindings, with no real structure as such.
Backbone, Knockout and many of the other frameworks mentioned in the article I linked address this problem, they allow you to create client side models and bring structure and cohesion to your client script. However, the way they are designed almost relegates MVC to a simple 'web API' to handle RESTful requests and respond with some JSON. You seem to end up moving logic that I believe should be in the 'server side controller' into a 'script controller', which I'm not really happy with.
I want a structured script representation of my Model, that wires up all by event handlers for my View and keeps everything in a logical order. But I still want model binding, data annotations, validation and logic in my controller, everything that should be handled by MVC.Net. I want the best of both in other words
I've read quite a bit on this subject, so I know there are many different options available to me - that's the very point of the link. I'm just interested how others developing in MVC are addressing this problem?
I have a textbox with multiline, i want to implement a feature in which i click a hyperlink or button then the whole content or selected content of textbox get copy to the clipboard.
Thanks In Advance,Appreciates your help
Hi all, I am trying to create textboxes dynamically and I came across a method that does mostly what I want while searching for a solution on line. The method below is what I've found
for(int i = 0; i<boxes; i++)
TextBox tb = new TextBox();
tb.Location = new System.Drawing.Point(40, 120 + i * 20);
tb.Name = "TextBoxName" + i.ToString();
tb.Size = new System.Drawing.Size(184,20);
tb.TabIndex = i + 2;
tb.Text = String.Empty;
The problem with the above code snippet is that sending values placed inside of the created textboxes to a database is difficult because the textboxes all have the same name. If each textbox can be given a different name when it is created, it will be great. Any suggestion is greatly appreciated, thanks in advance
Would you please explain how all textboxes have same name. The loop clearly says that every textbox created has index associated with its name. First textbox name reads "TextBoxName1", second reads "TextBoxName2" and so on. Where is the issue you are facing?
The problem u have is how to access the dynamically created textboxes, isn't it
look, the code u had written actually creates a number of objects of type TextBox, and give every one a name that is 'TextBoxName1', 'TextBoxName2',.. etc
the problem here is how to access the objects created.
so, you must declare a generic dictionary of string and TextBox on the class level, means
Dictionary<string,TextBox> AllTextBoxes = new
this code will be in the class level not inside any methods.
the second step is to add a line inside the loop to add items to this dictionary, each of them consists of a key and a value, the key is the name of textbox, while the value is the textbox object created in each loop, this line will be at the end of loop,