I am developing a custom column for DevExpress ASPxGridView.
At EditForm, I replaced the default edit textbox with a custom control that contains some other controls (label-textbox pairs).
Everything is working properly except one thing: since I have my own labels, I want to remove the edit form caption and expand my custom control to be rendered smoothly within the flow of other controls in the EditForm.
The EditForm is rendered as nested tables, then I am able to solve my problem manually in Chrome, by hiding the <td> that contains the caption, and expanding the colspan of the the <td> that contains my custom control, but I want to do this programmatically, how?
To hide column caption in the edit form, set the GridViewDataColumn.EditFormSettings.CaptionLocation property to ASPxColumnCaptionLocation.None
Related
I'm quite new to ASP.NET Web Form. How can we generate cards dynamically with the same idea as using GridView in ASP.NET VB language?
You can use Repeater Control which is used to display the repeated list of items in your own style in your case 'card'.
Repeater Control is used to display repeated list of items that are bound to the control and it’s same as gridview and datagridview. Repeater control is lightweight and faster to display data when compared with gridview and datagrid. By using this control we can display data in custom format but it’s not possible in gridview or datagridview and it doesn’t support for paging and sorting.
The Repeater control works by looping through the records in your data source and then repeating the rendering of it’s templates called item template. Repeater control contains different types of template fields those are
ItemTemplate
AlternatingItemTemplate
HeaderTemplate
FooterTemplate
SeperatorTemplate
ItemTemplate: ItemTemplate defines how the each item is rendered from data source collection.
AlternatingItemTemplate: AlternatingItemTemplates is used to change the background color and styles of AlternatingItems in DataSource collection
HeaderTemplate: HeaderTemplate is used to display Header text for DataSource collection and apply different styles for header text.
FooterTemplate: FooterTemplate is used to display footer element for DataSource collection
SeparatorTemplate: SeparatorTemplate will determine separator element which separates each Item in Item collection.
For more information Repeater - Microsoft Documentation
If you are new to ASP.NET, you should also look at DataList control.
It's similar to the Repeater control but easier to use as you don't have to "code" the templates yourself, you can design them in the page directly.
How can I make ASP textboxes be in a horizontal form? I want to know the code that will enable my textboxes to be in a straight line horizontally and not vertically.
Both, ASP and HTML textboxes are inline elements normally. In a new webform with empty template in ASP.NET just move into design tab and place a new Textbox. Click somewhere else, but remain inside the div, so that no control remains selected. Your cursor would be after the Textbox you just created, and the div is showing focus. Pick and drop another Textbox now. If everything is going correct, You will see two textboxes side by side.
No extra coding or css property required.
Here is a post by Microsoft
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/getting-started/creating-a-basic-web-forms-page#to-add-controls-to-the-page
In the Microsoft's post above, you can instead of placing a button, place a textbox.
We need to display the result of an SQL SELECT statement on a ASP.NET 3.5 web page. Although there are a number of columns that need to be displayed, only one of the columns needs an editable text box in it... however every record in the result set needs this editable textbox.
I know I can do this manually by building an html table myself, but I was hoping that there was a way to use a data-bound control (GridView? or ListView?) to do it.
Being somewhat new to ASP.NET, I am hoping there is some one out there who has done this.
--Thanks for your help!
A little further clarification....
We need all records to be editable immediately after display - so all records either need to be displayed in edit mode simultaneously - or the regular display mode needs to have an editable text box in it.
Use a GridView and convert the column that you want to be editable to Template.
In the ItemTemplate of this field, delete the Label and add a text box.
Add an extra "Save" button outside the GridView, and iterate the GridRows, find the text box (in each row), and use it to update the database.
Add a template column and then add a text box control instead of a label control
GridView BoundFields have the ReadOnly property which can be used to prevent the field from being edited in Edit mode. Set it to True for all columns that should not be editable.
<asp:boundfield datafield="myNonEditableColumn" Readonly="true" Headertext="My Non-Editable Column"/>
I know it's possible to change some columns in GridView controls to check boxes and when you are editing certain rows, the cells being hi-lited become text boxes, but supposed I want to add other controls in my gridView. For example: in the image below how would I change the entries of CategoryName to be a dropDown box of possible choices?
[Full size]
Use the TemplateField and define what controls are in your EditItemTemplate.
Read this article as a starting point.
I have a web form with a button and a DetailsView control on it. In the button's click event I change the DetailsView control to insert mode so I can add records:
DetailsView1.ChangeMode(DetailsViewMode.Insert)
Everything works fine, except for a checkbox in the DetailsView. When the DetailsView goes into insert mode, the text describing what the checkbox is for disappears. The checkbox itself works fine.
Why is my text disappearing and how can I fix it?
I was able to fix my problem by changing it to a template field. Not sure why it wouldn't work the other way.
Is the text in a Label that is in the item template? If so, you'd need to add it to the Edit Item Template.
Also check that the width of the control is wide enough for all the controls and text. It may be getting hidden due to absolute positioning.
Thanks for the quick reply. The text isn't in a template. It's just a CheckBoxField with the Text property set to "Active":
I've tried widening the field and the DetailsView control, but the text still disappears when I click the button.