My problem is I want to hide the edit column in my RadGrid and only show the "Delete" column and at the bottom a link to let the user insert or add a new record. If I do not hide the edit column then click my command button to show the insert code it works fine and I see an Insert and Cancel link. However, if I add visible = "false" to the GridEditCommandColumn like this:
<telerik:GridEditCommandColumn Visible="true" />
then all of a sudden my Insert and Cancel buttons disappear when in insert mode yet the form field is still there. I have also tried to hide the column programmatically in PreRender but the same thing happens. Please advise on how to hide the edit column without affecting the insert functionality.
| <telerik:RadGrid ID="myGrid" runat="server" |
| OnInsertCommand="myGrid_OnInsertCommand" |
| OnNeedDataSource="myGrid_OnNeedDataSource" |
| OnDeleteCommand="myGrid_OnDeleteCommand" |
| OnColumnCreated="myGrid_OnColumnCreated" |
| OnPreRender="myGrid_PreRender1" |
| Width="500px" AutoGenerateDeleteColumn="True" AllowFilteringByColumn="True" AutoGenerateColumns="False" |
| GridLines="None"> |
| <MasterTableView DataKeyNames="PhoneNumber" EditMode="InPlace" InsertItemDisplay="Bottom" |
| CommandItemDisplay="Bottom"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="PhoneNumber" HeaderText="Phone Number" UniqueName="PhoneNumber"> |
| </telerik:GridBoundColumn> |
| <telerik:GridEditCommandColumn Visible="false" /> |
| </Columns> |
| <EditFormSettings> |
| <EditColumn UniqueName="EditCommandColumn1" > |
| </EditColumn> |
| </EditFormSettings> |
| <CommandItemTemplate> |
| <div style="padding: 3px;"> |
| <asp:ImageButton ID="addNewPhonelistImg" runat="server" ImageUrl="add.gif" CommandName="InitInsert" /> |
| <asp:LinkButton CommandName="InitInsert" ID="addNewPhonelist" Text="Insert New Phone Number" |
| runat="server" Font-Size="Small" /> |
| </div> |
| </CommandItemTemplate> |
| </MasterTableView> |
| <FilterMenu> |
| </FilterMenu> |
| </telerik:RadGrid> |
http://demos.telerik.com/aspnet-ajax/grid/examples/client/resizing/defaultcs.aspx
I want my RAD GRID to show exactly it looks as yours.
My second issue is that, I want RAD GRID to occupy all the space/width for the COLUMN HEADER.
If we look carefully on to the DEMO GRID there is some space on the left size of the first column. I want it not to be shown as its been in demo.
If u please help me , it would be my pleasure.
Thanks.
i pass the value of the dataset(ds) to the detailsview datasource but it wont work can anybody help me?
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MeetingNotes.ascx.cs" Inherits="Project_MeetingNotes" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
public partial class Project_MeetingNotes : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Radgrid2_ItemCommand(object sender, EventArgs e)
{
Boolean strtxt;
int documentid;
foreach (GridNestedViewItem item1 in RadGrid1.MasterTableView.GetItems(GridItemType.NestedView))
{
RadGrid Grid2 = (RadGrid)item1.FindControl("RadGrid2");
foreach (GridDataItem childitem in Grid2.MasterTableView.Items)
{
if (childitem.Selected)
{
strtxt = Convert.ToBoolean(childitem["thumbnail_available"].Text);
if (strtxt != false)
{
documentid = Convert.ToInt32(childitem["library_docuemnt_images_id"].Text);
DataSet ds = LibraryDocument.GetDocument(documentid);
foreach (DataRow row in ds.Tables["Document"].Rows)
{
string documentImageId = string.Format("{0}", row["library_docuemnt_images_id"]);
string libraryDocumentId = string.Format("{0}", row["library_document_id"]);
string Uri = string.Format("{0}", row["uri"]);
DetailsView dv =(DetailsView) Grid2.FindControl("DetailsView1");
dv.DataSource = ds;
}
}
}
}
}
}

| <telerik:RadGrid runat="server" ID="RadGrdDashboard" |
| AllowPaging="True" |
| AutoGenerateColumns="False" |
| PageSize="5" |
| ShowStatusBar="True" |
| EnableAJAX="True" |
| DataSourceID="dsParent" |
| GridLines="None" |
| AllowFilteringByColumn="True" |
| Width="100%" |
| OnItemCreated="RadGrdDashboard_ItemCreated" |
| > |
| <MasterTableView DataSourceID="dsParent"> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="CustomerID" DataField="CustomerID" UniqueName="CustomerID" AllowFiltering="true"> |
| <FilterTemplate> |
| <telerik:RadComboBox ID="RadComboBoxContractID" runat="server" |
| OnClientSelectedIndexChanged="filterByCustomerID" |
| SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("CustomerID").CurrentFilterValue %>' Width="95px"> |
| <Items> |
| <telerik:RadComboBoxItem Text="All" Value="All" /> |
| <telerik:RadComboBoxItem Text="ALFKI" Value="ALFKI" /> |
| <telerik:RadComboBoxItem Text="ISLAT" Value="ISLAT" /> |
| </Items> |
| </telerik:RadComboBox> |
| </FilterTemplate> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Contact Name" DataField="ContactName" UniqueName="ContactName" AllowFiltering="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn"> |
| <HeaderTemplate> |
| <table id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0"> |
| <tr> |
| <td colspan="3" align="center"><b>Contact Info</b></TD> |
| </tr> |
| <tr> |
| <td width="50%" headers="ContactTitle" id="ContactTitle"><b>Contact Title</b></TD> |
| <td width="50%"><b>City</b></TD> |
| <td width="50%"><b>Phone</b></TD> |
| </tr> |
| </table> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <table id="Table2" cellSpacing="1" cellPadding="1" width="300" border="0"> |
| <tr> |
| <td width="50%"><%# DataBinder.Eval(Container.DataItem, "ContactTitle")%></TD> |
| <td width="50%"><%# DataBinder.Eval(Container.DataItem, "City")%></TD> |
| <td width="50%"><%# DataBinder.Eval(Container.DataItem, "Phone")%></TD> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn HeaderText="Company Name" DataField="CompanyName" UniqueName="CompanyName" AllowFiltering="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn1"> |
| <HeaderTemplate> |
| <table id="Table11" cellSpacing="1" cellPadding="1" width="300" border="0"> |
| <tr> |
| <td colspan="2" align="center"><b>Company Info</b></TD> |
| </tr> |
| <tr> |
| <td width="50%"><b>Country</b></TD> |
| <td width="50%"><b>Fax</b></TD> |
| </tr> |
| </table> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <table id="Table21" cellSpacing="1" cellPadding="1" width="300" border="0"> |
| <tr> |
| <td width="50%"><%# DataBinder.Eval(Container.DataItem, "Country")%></TD> |
| <td width="50%"><%# DataBinder.Eval(Container.DataItem, "Fax")%></TD> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnColumnClick="ColumnClick" OnGridCreated="GridCreated"/> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <asp:AccessDataSource ID="dsParent" DataFile="App_Data/Nwind.mdb" SelectCommand="SELECT * FROM Customers" |
| runat="server"></asp:AccessDataSource> |