6 Answers, 1 is accepted
Try increasing the Width of the Grid from 500px to 1000px and see whether the Edit column is appearing or not.
ASPX:
| <telerik:radgrid id="RadGrid1" runat="server" Width="1000px" > |
| <MasterTableView Width="1000px" > |
Shinu.
<
telerik:RadGrid ID="Grid" runat="server" Skin="Outlook" GridLines="None" EnableAjaxSkinRendering="true">
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" EditMode="InPlace" >
<CommandItemTemplate>
<asp:LinkButton ID="lnkBtnAddData" runat="server" CommandName="InitInsert" Visible="true"><img style="border:0px;vertical-align:middle;" alt="" src="../images/AddRecord.Gif" />
<asp:Literal ID="litAddData" runat="server" Text="Ajouter une donn‚e"></asp:Literal>
</asp:LinkButton>
</CommandItemTemplate>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" CancelText="Annuler la modification de la colonne"
UniqueName="EditCommandColumn" CancelImageUrl="../RadControls/Grid/Skins/Outlook/Cancel.Gif"
FilterImageUrl="" InsertText="Ajouter une colonne" InsertImageUrl="../RadControls/Grid/Skins/Outlook/Update.Gif"
SortAscImageUrl="" SortDescImageUrl="" UpdateText="Mettre … jour la colonne"
UpdateImageUrl="../RadControls/Grid/Skins/Outlook/Update.Gif" EditText="Modifier la colonne"
EditImageUrl="../RadControls/Grid/Skins/Outlook/Edit.Gif">
<HeaderStyle Width="40px" />
<ItemStyle HorizontalAlign="Center" Width="40px"/>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Supprimer la colonne" ConfirmText="D‚sirez-vous supprimer cette colonne ?" ConfirmDialogType="RadWindow"
UniqueName="DeleteColumn" ImageUrl="../RadControls/Grid/Skins/Outlook/Delete.Gif">
<HeaderStyle Width="20px" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridButtonColumn>
</Columns>
<NoRecordsTemplate>
<asp:Label ID="lblNoRecordsTemplate" runat="server" Text="Aucun enregistrement"></asp:Label>
</NoRecordsTemplate>
<ItemStyle Font-Names="Tahoma" Font-Size="8pt" />
</MasterTableView>
</
telerik:RadGrid>
Now I add 10 columns like this :
For Each col As GridColumnDefinition In Columns
Dim column As GridBoundColumn = New GridBoundColumn
column.HeaderStyle.Width = col.Width
column.HeaderText = col.HeaderText
column.DataField = col.Name
column.UniqueName = col.Name
Me.Grid.MasterTableView.Columns.Add(column)
Next
Theses 10 columns has a total width of 940px. Theses 10 colums + 2 editcommandcolumn (40px and 20px) do a total of 1000px
Since you have created the RadGrid statically and adding its structure dynamically first add the Column to the column collection and then set its properties.
CS:
| private void Page_Load(object sender, System.EventArgs e) |
| { |
| if ( !IsPostBack ) |
| { |
| GridBoundColumn boundColumn; |
| //Important: first Add column to the collection |
| boundColumn = new GridBoundColumn(); |
| this.RadGrid1.MasterTableView.Columns.Add(boundColumn); |
| //Then set properties |
| boundColumn.DataField = "CustomerID"; |
| boundColumn.HeaderText = "CustomerID"; |
| } |
| } |
Shinu.
Here's how I add my column dynamically. What's wrong ?
'Remove add data button
If Not EnableInsertButton Then
Me.Grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None
End If
Me.Grid.Width = Width
Me.Grid.Height = Height
'Set client settings section
Me.Grid.ClientSettings.Scrolling.AllowScroll = True
Me.Grid.ClientSettings.Scrolling.UseStaticHeaders = True
Me.Grid.ClientSettings.Scrolling.ScrollHeight = Height - 20
'Add columns to grid
Dim MasterTableViewWidth As Integer = 0
For Each col As GridColumnDefinition In Columns
Dim column As GridBoundColumn = New GridBoundColumn
Me.Grid.MasterTableView.Columns.Add(column)
column.HeaderStyle.Width = col.Width
column.HeaderText = col.HeaderText
column.DataField = col.Name
column.UniqueName = col.Name
MasterTableViewWidth += col.Width
Next
'Set mastertableview section
Me.Grid.MasterTableView.Width = Unit.Pixel(MasterTableViewWidth)
Me.Grid.MasterTableView.TableLayout = GridTableLayout.Fixed