This is a migrated thread and some comments may be shown as answers.

Rad Grid Edit Template - Change Size of Fields?

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 14 Apr 2014, 02:51 PM
I have a radgrid and I have enabled edit/insert/update. The Grid does a great job of auto generating the fields and column sizes to fix the context of the data. How do I change the Edit/Insert "Popup" for the fields that need to be larger and with scrollbars? Below is my code that builds the RadGrid - how do I get to the setup I am wanting. I want to make the Issue/Notes/CorrectiveAction fields larger and almost like a memo field. Also how do you change to position of the field in the edit popup by making the window larger and placing the fields in different location..

My Radgrid Code as it is now.


<telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="OpenAccessLinqDataSource1" Skin="Sunset" CellSpacing="-1" GridLines="Both" AutoGenerateEditColumn="True">
<ExportSettings ExportOnlyData="True" FileName="SystemCabCommExport">
<Excel Format="ExcelML" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="False" editmode="PopUp" CommandItemDisplay="Top" DataKeyNames="ItemNum" DataSourceID="OpenAccessLinqDataSource1">
<Columns>
<telerik:GridBoundColumn DataField="ItemNum" DataType="System.Int32" FilterControlAltText="Filter ItemNum column" HeaderText="ItemNum" ReadOnly="True" SortExpression="ItemNum" UniqueName="ItemNum">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="_Date" DataType="System.DateTime" FilterControlAltText="Filter _Date column" HeaderText="_Date" SortExpression="_Date" UniqueName="_Date">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="IssueType" FilterControlAltText="Filter IssueType column" HeaderText="IssueType" SortExpression="IssueType" UniqueName="IssueType">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Issue" FilterControlAltText="Filter Issue column" HeaderText="Issue" SortExpression="Issue" UniqueName="Issue">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ReportedBy" FilterControlAltText="Filter ReportedBy column" HeaderText="ReportedBy" SortExpression="ReportedBy" UniqueName="ReportedBy">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ResponsiblePerson" FilterControlAltText="Filter ResponsiblePerson column" HeaderText="ResponsiblePerson" SortExpression="ResponsiblePerson" UniqueName="ResponsiblePerson">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Notes" FilterControlAltText="Filter Notes column" HeaderText="Notes" SortExpression="Notes" UniqueName="Notes">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CorrectiveAction" FilterControlAltText="Filter CorrectiveAction column" HeaderText="CorrectiveAction" SortExpression="CorrectiveAction" UniqueName="CorrectiveAction">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ClosedDate" DataType="System.DateTime" FilterControlAltText="Filter ClosedDate column" HeaderText="ClosedDate" SortExpression="ClosedDate" UniqueName="ClosedDate">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 16 Apr 2014, 06:53 AM
Hi Alex,

I guess you want to set the Textbox to multiline mode for some columns, please try the following code snippet.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
  if (e.Item.IsInEditMode && e.Item is GridEditableItem)
  {
    GridEditableItem edit = (GridEditableItem)e.Item;
    TextBox txtIssue = (TextBox)edit["Issue"].Controls[0]; //Accesss the Issue column
    txtIssue.TextMode = TextBoxMode.MultiLine;         
  }
}

In case you want to change the PopUp height and width, you can use EditFormSettings->PopUpSettings . For changing the position of the fields you can try to set the EditFormColumnIndex.

ASPX:
<telerik:GridBoundColumn DataField="Issue" HeaderText="Issue" SortExpression="Issue" UniqueName="Issue" EditFormColumnIndex="2">
. .
</telerik:GridBoundColumn>
 . . . .
 <EditFormSettings ColumnNumber="3">
    <PopUpSettings Width="800px" Height="200px" />
</EditFormSettings>

Thanks,
Shinu

Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or