Hello,
I am using <EditItemTemplate> in my radgrid and want to adjust the layout of the edit form table column cells. The problem is that I want to set the horizontal and vertical attributes of the cells that hold the item label and the input control.
So for example, currently the label is centered and the input control looks like it is aswell, so when there is multiple rows (for example, in the below code they get 'Name' and 'Description' fields to edit) they do not line up well in the edit form.
For example, what I want to be able to do is set the label (header?) to align to the right, and the input control (textbox) to align to the left. This would make a clean and consistent look to all the edit rows.
I have tired all types of things and have affected just about everything else, including the form that holds the edit rows, but could not figure out how to affect the actual cells of the edit rows.
Here is the vb radgrid code:
<
telerik:RadGrid
ID
=
"sections"
runat
=
"server"
GridLines
=
"None"
Skin
=
"Office2007"
OnItemDataBound
=
"section_ItemDataBound"
OnNeedDataSource
=
"section_NeedDataSource"
AutoGenerateColumns
=
"False"
OnDeleteCommand
=
"sections_DeleteCommand"
OnInsertCommand
=
"sections_InsertCommand"
OnUpdateCommand
=
"sections_UpdateCommand"
>
<
ExportSettings
ExportOnlyData
=
"True"
HideStructureColumns
=
"True"
IgnorePaging
=
"True"
OpenInNewWindow
=
"True"
>
</
ExportSettings
>
<
MasterTableView
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add Section"
ItemStyle-HorizontalAlign
=
"Left"
AlternatingItemStyle-HorizontalAlign
=
"Left"
DataKeyNames
=
"sec_id"
>
<
CommandItemSettings
AddNewRecordText
=
"Add Section"
></
CommandItemSettings
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"sec_id"
HeaderText
=
"ID"
DataField
=
"sec_id"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Name"
UniqueName
=
"label"
ItemStyle-Width
=
"300"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"label_edit"
runat
=
"server"
Text='<%# Bind("label") %>' Width="400"
MaxLength="250"></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ErrorMessage
=
"(required)"
ControlToValidate
=
"label_edit"
></
asp:RequiredFieldValidator
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
a
href='/view/Default.aspx?sec_id=<%#DataBinder.Eval(Container.DataItem, "sec_id") %>'>
<%#Eval("label")%></
a
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Description"
UniqueName
=
"description"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"description_edit"
runat
=
"server"
Text='<%# Bind("description") %>'
Width="400" TextMode="MultiLine" Rows="2"></
asp:TextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"description_view"
runat
=
"server"
Text='<%# Eval("description") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Edit"
Text
=
"Edit"
UniqueName
=
"EditSection"
ItemStyle-Width
=
"30"
ItemStyle-HorizontalAlign
=
"Center"
>
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteSection"
ItemStyle-Width
=
"40"
ItemStyle-HorizontalAlign
=
"Center"
>
</
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>