I wanna ask for your opinions/ideas about how to automatically add new Textbox when user click on Add button. In my system, there are 2 Textboxes which user need to enter expenses and price respectively. And there's also a ADD button. When they click on it, another two boxes will automatically generate. Before this, I only have 8 Textboxes for expenses and 8 Textboxes for their price. But it looks quite messy for me so i want to make it more tidy. Thank you
You could use a grid and then have a hidden row that has the same input cells as the other rows. When the add button is clicked, have javascript clone the hidden row and then add then show it, and add it to the bottom of the grid.
If a grid isn't right for your UI then do the same thing with just cloning a text box and showing it. It is often easier to just have a single hidden input field with the proper style applied and then clone it, and then remove the display: hidden.
But it looks quite messy for me so i want to make it more tidy.
GridView should be used to make it visibility better and consume space properly.
Assign the DataSource to your GridView
Set the Text boxes in your Footer
When you click the Add Button, Set the Visibility of your Footer "True"
Once user fills the values in Textbox save it and Bind to the GridView.
Repeat Step 4 to iterate the same process next time.
Related
In the picture below I have defined a 6-row table layout and placed controls inside its cells, in one cell goes the Label, the other cell for the control its self (a text box for example )
The problem is caused by that field options radio box, it will make the cell so big so then the text box that is under "Preview Data Value" label, goes way below...
How do you suggest fixing this issue?
From my prior experience, I would not use the table layout at all. Instead I would set the anchors on each control to dynamically change with resize.
But if you insist on using the table layout, perhaps you should change the RowSpan attribute of the Preview Data Value cell, and have the label at the top with the text box underneath.
Another option would be to use a container like a GroupBox with a title Attribute that you can set to "Preview Data Value", put the text box in that container and set the "Dock" Attribute to "Fill". Then from the looks of it, you don't even need the last Row.
See this article on MSDN if you want to go totally nuts and implement your own drawing.
Make a seventh row and have the option group span two rows.
In a list view in C# how can I make all the fields in a column editable at once? Right now I have the standard edit button which allows me to update just one line at a time. I want the end user to be able to click a button and allow then to edit the column in its entirety.
Rebind the ListView with all TextBoxes when the user clicks edit.
You would have to manually track if you're in edit mode or not and on postback loop through all the rows retrieving the values from the textboxes and store them.
There is no built-in functionallity for what you're trying to do but it's possible.
I have an ASP.NET repeater which contains grid view and a panel which contains save button.
the repeater displays grid and save button for each employee..
if there are 5 employees then 5 grids and 5 save button will be displayed.
Now i want to move the save button to Header.. in that case i'll have only one save button for all the grids..
if any grid is modified and i click the Save button, how can we know which grid is edited.
pls help.
If the grids don't post back, i'm not sure it's possible to know which grid was edited. You could add an hidden field to the page (asp:HiddenField) and modify the value using javascript and then check the hidden value when the save button is pressed. Also, why do you have a save button? The gridview has full support for CRUD (Create/Read/Update/Delete) operations.
i think you can use "for each" to loop throw all items in the repeater
and you can check if there is any change in the item then save it if not then leave it and move to the next item.
I have a a gridview with a dynamic number of columns and rows. In each of the gridiview cells, a textbox get's added dynamicaly. I need users to be able to tab through these textboxes, but I can't get it to work.
I set the tabindex of the the textbox when it is created in the code behind, however when I try and tab in the page it doesn't work. If I click inside a textbox in the grdiview then pressing tab does nothing at all, If I click outside the gridview I can tab through the other controls on the page, and it will tab into the first cell of the gridiview, and then stop/
Perhaps you can create a javascript method to get a list of all textboxes on the page, and shift focus to the next one, by checking for a keypress event?
Well I solved the problem. I had some javascript running on Key Down to prevent users entering anything other than numbers, which blocked tabbing. Removed it and it worked.
I have a web application(ASP.NET2.0 C#) and in it, I have a gridview that gets its data from a datasource.
I wanted to add the following feature: the user can click a button "select columns", and a box pops up with a list of all the columns(a checkboxlist in a div, possibly) and that way, the user can choose the columns they want to see, and click another button "show" and the list of columns goes away, and the table shows the columns that the user selected.
I have already implemented the column choosing part, but it is the popup part that I need help with. How can I make the div popup and then disappear?
The solution might require javascript, and I might not have figured it out since I don't really know javascript that well.
Thank you.
HI,
Its better to make the display of div to be none rather than setting visibility to hidden. If visibility is set to hidden even if the div doesn't show up but it will take the rendering space which in some situation might not be that good.
You can dynamically create a div using createNode and then by absolute positioning and setting the top and left according to your convenience you can align the div to any portion in the page. Its better if you could disable the background when the div pops out.
Create the div and set visible=false. When you want to pop it up write the javascript to set it visible=true.
here's a good pointer http://lists.evolt.org/archive/Week-of-Mon-20020624/116151.html