If your wanting to only show one record from a database that has many columns can you use a datagrid that will put each column into its own row? How would you do this?
I also need the user to be able to edit this. I know that the datagrid supports that, but does the datalist?? I like frost10 suggestion, but could you edit it then? What do you suggest? Datalist or Datagrid?
If Datalist (hardly worked with them) can do it, then go for it.
Worst case, you could do the datagrid way.
Um, just a third thought too though:
If you want the users to be able to edit it, why not just create a user interface out of textboxes instead of using a datagrid? You coudl create an object that holds the record values, and just drop the values into the textboxes.
I think that is a great idea, but the reason I was thinking of using a datagrid was because I wanted to display the user there current information and then have an edit command incase they wanted to change something. So everything could be on one page
When the data is displayed, you could have the textboxes to be in ReadOnly mode. When they click edit, it unlocks all the fields so they can edit them.
If you wanted to get super fancy, you could even change the look of the textbox between viewing and editing (so like the textbox would look like a label or soemting for viewing, but when you click edit it would look more like a text box).
There's alot of stuff you can do with the interface, but yeah, thats how you'd set the read only
Truthfully, I'd to teh textbox thing if it was only ever going to be for one record at a time.
And yeah, you could look at doing it through the CSS. problem is that CSS is mainly look-wise stuff, whereas items like the textbox's ReadOnly property can't be accessed that way (to my knowledge anyway), in which case you'd need code behind.
All of our edit screens in our webapplication use the textbox version, and not direct editing within datagrids.
If your not using CSS, then how do you make it look like a label in the read only mode? what do you change to make it look like a textbox then when editing?
Truthfully, I'd to teh textbox thing if it was only ever going to be for one record at a time.
And yeah, you could look at doing it through the CSS. problem is that CSS is mainly look-wise stuff, whereas items like the textbox's ReadOnly property can't be accessed that way (to my knowledge anyway), in which case you'd need code behind.
All of our edit screens in our webapplication use the textbox version, and not direct editing within datagrids.
K, Textboxes have a slew of properties that you can change. For instance:
With TextBox1
.BorderStyle = Solid
.BorderWidth = 1
End With
Will give you a text box that has a solid border, and doesn't have the traditional ridged/grooved (always get those mixed up) border.
If you set
With TextBox1
.BorderStyle = NotSet
.BorderWidth = Nothing
End Width
Then that gives you back the regular text box.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.