3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 14 Mar 2013, 03:57 AM
Hi,
Try the following code.
C#:
Thanks,
Shinu
Try the following code.
C#:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; CheckBox chk = (CheckBox)item["Uniquename"].Controls[0]; chk.Visible = false; }}Thanks,
Shinu
0
Kjell
Top achievements
Rank 1
Iron
Iron
answered on 14 Mar 2013, 07:59 AM
Sorry, nothing happends :-(
When i cklick "Add new record" the checkbox is visible and enabled,....
I put this in my code:
When i cklick "Add new record" the checkbox is visible and enabled,....
I put this in my code:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then Dim editItem As GridEditableItem = TryCast(e.Item, GridEditableItem) Dim txt As TextBox = DirectCast(editItem("id").Controls(0), TextBox) txt.Visible = False End If If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem) Dim txtForening As TextBox = DirectCast(item("foren_namn").Controls(0), TextBox) txtForening.Width = Unit.Percentage(96) Dim txtUsername As TextBox = DirectCast(item("username").Controls(0), TextBox) txtUsername.Width = Unit.Percentage(96) Dim txtPassword As TextBox = DirectCast(item("password").Controls(0), TextBox) txtPassword.Width = Unit.Percentage(96) Dim txtCalendarUser As TextBox = DirectCast(item("calendar_user").Controls(0), TextBox) txtCalendarUser.Width = Unit.Percentage(96) End If If e.Item.GetType() Is GetType(GridDataItem) Then Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) Dim btn As ImageButton If item("DeleteColumn").Controls(0) IsNot Nothing Then btn = DirectCast(item("DeleteColumn").Controls(0), ImageButton) btn.ToolTip = "Radera denna användare?" btn.AlternateText = "Radera denna användare?" End If End If If TypeOf e.Item Is GridEditFormInsertItem AndAlso e.Item.OwnerTableView.IsItemInserted Then Dim item As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem) Dim chk As CheckBox = DirectCast(item("visa").Controls(0), CheckBox) chk.Visible = False End IfEnd Sub0
Hello Kjell,
I prepared a small sample where I used the approach suggested by Shinu. As you could see everything work properly. Could you please give it a try and let me know how it differs from your real setup?
All the best,
Kostadin
the Telerik team
I prepared a small sample where I used the approach suggested by Shinu. As you could see everything work properly. Could you please give it a try and let me know how it differs from your real setup?
All the best,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.