Hello, I've got a lot of issues with RadGrid. I suppose I don't use it in a standard way ?
Well, I have first a simple question:
I have some dataset created on the fly, and I link a radGrid to it. (to its first table)
One of the columns is a classic "Id" auto-inc primary key, which is set to ReadOnly
So when the user edits one row, I would like the "id" column ot be "not editable"
BUT the IsEditable property is a "get" property, which returns true ...
Relevant Code:
bool ised = boundColumn.IsEditable; // RETURNS TRUE !! and the corresponding field is shown while editing.
How to set the radGrid column to "not editable" so that no entry textbox is generated ?
Thank you!
Well, I have first a simple question:
I have some dataset created on the fly, and I link a radGrid to it. (to its first table)
One of the columns is a classic "Id" auto-inc primary key, which is set to ReadOnly
So when the user edits one row, I would like the "id" column ot be "not editable"
BUT the IsEditable property is a "get" property, which returns true ...
Relevant Code:
<telerik:RadGrid ID="RadGrid1" runat="server" |
AllowSorting="True" |
AutoGenerateDeleteColumn="True" |
AutoGenerateEditColumn="True" oncolumncreated="RadGrid1_ColumnCreated" |
ondatabound="RadGrid1_DataBound" |
onneeddatasource="RadGrid1_NeedDataSource" |
onitemupdated="RadGrid1_ItemUpdated" onrowdrop="RadGrid1_RowDrop" |
onupdatecommand="RadGrid1_UpdateCommand" |
AllowMultiRowEdit="True" |
> |
<MasterTableView DataKeyNames ="cID" EditMode="InPlace"> |
... |
if (mydt.PrimaryKey == null || mydt.PrimaryKey.Length<1) |
{ // if there is no primary |
DataColumn col = new DataColumn("cID", typeof(int)); |
col.AutoIncrement = true; |
mydt.Columns.Add(col); |
int rc = 0; |
foreach (DataRow drw in mydt.Rows){ rc++; drw["cID"] = rc;}//fill for existing rows |
mydt.PrimaryKey = new DataColumn[] { mydt.Columns["cID"] }; |
} |
nDS.Tables[0].Columns["cID"].ReadOnly = true; |
RadGrid1.DataSource = nDS.Tables[0]; |
RadGrid1.AutoGenerateColumns = false; |
GridBoundColumn boundColumn; |
boundColumn = new GridBoundColumn(); |
RadGrid1.MasterTableView.Columns.Add(boundColumn); |
boundColumn.DataField = "cID"; |
boundColumn.HeaderText= "id"; |
bool ised = boundColumn.IsEditable; //RETURNS TRUE ! |
bool ised = boundColumn.IsEditable; // RETURNS TRUE !! and the corresponding field is shown while editing.
How to set the radGrid column to "not editable" so that no entry textbox is generated ?
Thank you!