8 Answers, 1 is accepted
Please test the attached example and let us know if you need further assistance.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The only difference that I have from your code is that I have AutoGenerateColumns="False"
Here's my tag :
<
telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="True"
AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource5"
GridLines="None" PageSize="30" ShowGroupPanel="True" Skin="Telerik" ShowStatusBar="True"
Width="100%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" OnPreRender="RadGrid2_PreRender"
EnableLinqExpressions="False" AutoGenerateEditColumn="True"
onitemcommand="RadGrid2_ItemCommand">
A suggestion would be to use a FormTemplate EditForm which mimics the AutoGeneratedEditForm excluding the column you woukld require to hide.
Thanks
Princy.
I could also use EditMode="InPlace"
The question is if I can do it in edit form mode.
I have another problem too.
How can I add an insert button?
Thank you!
CommandItemDisplay
="TopAndBottom"
in the MastertableView tag.
Try setting the ReadOnly property of this GridBoundColumn to true. I think this can help.
It worked!
The only thing I have not managed to do yet is to program properly the insert record form.
There is a building_id column that is identity field in the database so the user should not be able to insert a number in it because the database add a number automatically.
I also want to code the insert form so that it enters automatically the customer_id in the hidden column.
I get this id in the page code behind file with the following code :
string UserID; //globally declare the UserId |
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
MembershipUser myObject = Membership.GetUser(); |
UserID = myObject.ProviderUserKey.ToString(); |
} |
I modified the previous example to illustrate the needed functionality.
Some notes:
CategoryID is auto-generated by the database (read-only)
CategoryName is modified in code-behind (read-only)
Description is editable by the user
Hope this helps.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.