Can you give any suggestion on working with add and edit operation with a sample like the NorthWind Customers db?
With identity keys your examples seem to ignore the value and hide it from the user, but do you have a demo like the above.
Phil
With identity keys your examples seem to ignore the value and hide it from the user, but do you have a demo like the above.
Phil
7 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 29 Jan 2010, 04:56 AM
Hi,
A suggestion would be to bind a GridBoundColumn to the primary key field and then set its Visible property to False. In the edit mode you will be able to edit or insert the primary key field which will otherwise not be visble to the user in normal mode.Make sure that you use the EditMode "EditForms" and not "Inplace".
Thanks,
Princy
0
Phil
Top achievements
Rank 2
answered on 29 Jan 2010, 01:09 PM
I have a couple of forms that I would like to use InPlace edit-form. What is the issue with InPlace? Could it be solved by converting to GridTemplateColumn?
Phil
Phil
0
Hello Phil,
The approach mentioned previously is still applicable if you are using inline editing as well.
Let me know how this setup falls short in meeting your requirements.
Kind regards,
Yavor
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
The approach mentioned previously is still applicable if you are using inline editing as well.
Let me know how this setup falls short in meeting your requirements.
Kind regards,
Yavor
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Phil
Top achievements
Rank 2
answered on 10 Feb 2010, 02:25 AM
What is the mentioned issue with InPlace?
0
Hello Phil,
Could you please specify what is the issue you are facing with the RadGrid InPlace edit mode? Please elaborate a bit on your scenario and if possible share your grid declaration here.
Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Could you please specify what is the issue you are facing with the RadGrid InPlace edit mode? Please elaborate a bit on your scenario and if possible share your grid declaration here.
Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Phil
Top achievements
Rank 2
answered on 28 Apr 2010, 02:28 AM
Example using Northwind customer table:
Code behind:
Phil
<Telerik:GridTemplateColumn HeaderText="CustomerID" UniqueName="CustomerIDColumn" AllowFiltering="True" > |
<ItemTemplate> |
<asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>' /> |
</ItemTemplate> |
<EditItemTemplate> |
<asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>' /> |
<asp:TextBox ID="CustomerIDTextBox" runat="server" Text='<%# Bind("CustomerID") %>' /> |
</EditItemTemplate> |
</Telerik:GridTemplateColumn> |
protected void customersGrid_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
// GridTemplateColumn |
GridEditFormItem _editItem = e.Item as GridEditFormItem; |
TableCell _cell = _editItem["CustomerIDColumn"]; |
TextBox _textBox = (_cell.Controls[0].FindControl("CustomerIDTextBox") as TextBox); |
Label _label = (_cell.Controls[0].FindControl("CustomerIDLabel") as Label); |
if (e.Item.OwnerTableView.IsItemInserted) |
{ |
//item is about to be inserted |
_label.Visible = false; |
_textBox.Visible = true; |
} |
else |
{ |
//item is about to be edited |
_label.Visible = true; |
_textBox.Visible = false; |
} |
} |
} |
0
Hello Phil,
Try modifying the ItemDataBound event handler as below and see if it makes any difference:
Let me know how it goes.
Kind regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Try modifying the ItemDataBound event handler as below and see if it makes any difference:
protected
void
customersGrid_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
// GridTemplateColumn
GridEditableItem _editItem = e.Item
as
GridEditableItem;
TableCell _cell = _editItem[
"CustomerIDColumn"
];
TextBox _textBox = (_cell.Controls[0].FindControl(
"CustomerIDTextBox"
)
as
TextBox);
Label _label = (_cell.Controls[0].FindControl(
"CustomerIDLabel"
)
as
Label);
if
(e.Item.OwnerTableView.IsItemInserted)
{
//item is about to be inserted
_label.Visible =
false
;
_textBox.Visible =
true
;
}
else
{
//item is about to be edited
_label.Visible =
true
;
_textBox.Visible =
false
;
}
}
}
Let me know how it goes.
Kind regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.