Julia Shah
Top achievements
Rank 1
Julia Shah
asked on 22 Jun 2009, 11:26 PM
Hi,
I have a grid with one GridDropDownColumn and two GridBoundColumns. I've set AllowAutomaticInserts and AllowAutomaticUpdates to True. I add rows by selecting a value from a dropdown and entering values in the textboxes. Now I'd like to be able to edit rows by changing the values in the textboxes, but I don't want to allow editing the first dropdown column. If I put ReadOnly, then I can't use the dropdown on Insert. Is there a way to be able to insert, but not edit a column?
Thanks,
Julia
I have a grid with one GridDropDownColumn and two GridBoundColumns. I've set AllowAutomaticInserts and AllowAutomaticUpdates to True. I add rows by selecting a value from a dropdown and entering values in the textboxes. Now I'd like to be able to edit rows by changing the values in the textboxes, but I don't want to allow editing the first dropdown column. If I put ReadOnly, then I can't use the dropdown on Insert. Is there a way to be able to insert, but not edit a column?
Thanks,
Julia
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 23 Jun 2009, 04:07 AM
HI Julia,
Try the following code snippet to achieve the desired scenario.
CS:
Thanks
Shinu
Try the following code snippet to achieve the desired scenario.
CS:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)&&(!e.Item.OwnerTableView.IsItemInserted)) |
| { |
| GridEditableItem editItem = (GridEditableItem)e.Item; |
| editItem["columnUniqueName"].Parent.Visible = false; |
| } |
| } |
Thanks
Shinu
0
Julia Shah
Top achievements
Rank 1
answered on 23 Jun 2009, 07:07 PM
Thank you for your reply! I had to modify the code a little bit to make it work:
Now it doesn't let me change the selection in the dropdown, which is great. But it creates another problem: after I click on "Update" icon, the row stays in editable mode. Why is that?
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted)) |
| { |
| GridEditableItem editItem = (GridEditableItem)e.Item; |
| editItem["columnUniqueName"].Enabled = false; |
| } |
| } |
Now it doesn't let me change the selection in the dropdown, which is great. But it creates another problem: after I click on "Update" icon, the row stays in editable mode. Why is that?
0
Shinu
Top achievements
Rank 2
answered on 24 Jun 2009, 05:00 AM
Hi Julia,
Have you set AllowAutomaticUpdates to true ? If you are performing Update operation manually can you try setting AllowAutomaticUpdates to false and see whether the Edit form is getting closed after the Update operation.
Shinu.
Have you set AllowAutomaticUpdates to true ? If you are performing Update operation manually can you try setting AllowAutomaticUpdates to false and see whether the Edit form is getting closed after the Update operation.
Shinu.
0
Julia Shah
Top achievements
Rank 1
answered on 24 Jun 2009, 06:36 PM
Yes, I've set AllowAutomaticUpdates to True, and I don't do the update manually in this case.
When I am in debugger, I see that this condition
When I am in debugger, I see that this condition
| if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted)) |
is met even after I click on "Update".
How can I make sure that it works only on clicking "Edit", but not "Update"?
Thanks,
Julia
0
Hello Julia,
I'm unable to reproduce the aforementioned case. My test project is attached to this post. Could you please modify it (and send it back via support ticket) to help me recreate your scenario?
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I'm unable to reproduce the aforementioned case. My test project is attached to this post. Could you please modify it (and send it back via support ticket) to help me recreate your scenario?
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.