Okay so I've been through the forums and the tutorials but I must have a hard head this week because I'm still not getting it. :)
How do I create a custom edit form for a nested grid? I want to change a couple of the text boxes to combo boxes, but when I tried it in the source code it didn't work, i.e. it didn't look like I did anything.
How do I create a custom edit form for a nested grid? I want to change a couple of the text boxes to combo boxes, but when I tried it in the source code it didn't work, i.e. it didn't look like I did anything.
13 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 12 Aug 2008, 04:24 AM
Hello Alice,
I would suggest you to use GridDropDownColumns instead of GridBoundColumns where data appears as in GridBoundColumns, when in Normal mode and when in Edit mode data would be bound to dropdownlists.
aspx:
You can also refer to this link - Column Types
Another alternative would be to replace the default Edit form with a UserControlEditForm or TemplateEditForm .
Thanks
Princy.
I would suggest you to use GridDropDownColumns instead of GridBoundColumns where data appears as in GridBoundColumns, when in Normal mode and when in Edit mode data would be bound to dropdownlists.
aspx:
<telerik:GridDropDownColumn UniqueName="DropDownListColumn" ListTextField="CustomerID" ListValueField="CustomerID" DataSourceID="SqlDataSource1" DataField="ContactName" > |
</telerik:GridDropDownColumn> |
You can also refer to this link - Column Types
Another alternative would be to replace the default Edit form with a UserControlEditForm or TemplateEditForm .
Thanks
Princy.
0
Alice
Top achievements
Rank 1
answered on 14 Aug 2008, 12:13 AM
Thanks,
That's all good but I'm still not sure where in the code I'm supposed to effect the changes, or what property to use. Is it done under the master table or the nested grid?
That's all good but I'm still not sure where in the code I'm supposed to effect the changes, or what property to use. Is it done under the master table or the nested grid?
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2008, 05:33 AM
Hi Alice,
This is how you can implement a template Editform for the master and child table in Grid hierarchy.
ASPX:
Thanks
Shinu.
This is how you can implement a template Editform for the master and child table in Grid hierarchy.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="True" DataSourceID="SqlDataSource1" > |
<MasterTableView DataSourceID="SqlDataSource1" EditMode="EditForms" > |
<EditFormSettings EditFormType="Template" > |
<FormTemplate> |
<telerik:RadComboBox ID="RadComboBox1" runat="server" > |
</telerik:RadComboBox> |
</FormTemplate> |
</EditFormSettings> |
<Columns> |
<telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" |
UniqueName="FirstName"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName" |
UniqueName="LastName"> |
</telerik:GridBoundColumn> |
<telerik:GridEditCommandColumn> |
</telerik:GridEditCommandColumn> |
</Columns> |
<DetailTables> |
<telerik:GridTableView runat="server" EditMode="EditForms" DataSourceID="SqlDataSource1" > |
<EditFormSettings EditFormType="Template" > |
<FormTemplate> |
<telerik:RadComboBox ID="RadComboBox2" runat="server" > |
</telerik:RadComboBox> |
</FormTemplate> |
</EditFormSettings> |
<Columns> |
<telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" |
UniqueName="FirstName"> |
</telerik:GridBoundColumn> |
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> |
</Columns> |
</telerik:GridTableView> |
</DetailTables> |
</MasterTableView> |
</telerik:RadGrid> |
Thanks
Shinu.
0
Alice
Top achievements
Rank 1
answered on 16 Aug 2008, 04:37 PM
Thanks,
That's what I needed. I'm about half way there now. I've got the form set up the way I want it, but the "cancel" and the "update" links don't show up.
I just need to know how to add them back in. :)
That's what I needed. I'm about half way there now. I've got the form set up the way I want it, but the "cancel" and the "update" links don't show up.
I just need to know how to add them back in. :)
0
Hi Alice,
Since you are using a Template edit form for the inner grid, you will need to manually include Cancel/Update Buttons or link buttons for the form. These must also have the appropriate commandName. I hope this information helps.
Kind regards,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Since you are using a Template edit form for the inner grid, you will need to manually include Cancel/Update Buttons or link buttons for the form. These must also have the appropriate commandName. I hope this information helps.
Kind regards,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 18 Aug 2008, 07:03 AM
Hi Alice,
Try placing the Update and Cancel Linkbuttons in the FormTemplate as shown below.
ASPX:
CS:
Thanks
Shinu.
Try placing the Update and Cancel Linkbuttons in the FormTemplate as shown below.
ASPX:
<EditFormSettings EditFormType="Template" > |
<FormTemplate> |
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> |
<asp:LinkButton ID="LinkButton3" runat="server" Text="Update" CommandName="Update" ></asp:LinkButton> |
<asp:LinkButton ID="LinkButton2" runat="server" Text="Cancel" CommandName="Cancel" ></asp:LinkButton> |
</FormTemplate> |
</EditFormSettings> |
CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == "Update") |
{ |
} |
} |
Thanks
Shinu.
0
Alice
Top achievements
Rank 1
answered on 24 Aug 2008, 06:41 PM
Thanks,
I've added the link buttons in the form but I'm not sure about the code for the click event, since it's in a nested grid. Could you help me with the code for this in vb?
I've added the link buttons in the form but I'm not sure about the code for the click event, since it's in a nested grid. Could you help me with the code for this in vb?
0
Accepted
Shinu
Top achievements
Rank 2
answered on 25 Aug 2008, 05:07 AM
Hi Alice,
ItemCommand event will fire for both master and detail table. Make sure that you have set the CommandName property for the LinkButton in the aspx. Here is the code snippet in VB.
VB:
Thanks
Shinu.
ItemCommand event will fire for both master and detail table. Make sure that you have set the CommandName property for the LinkButton in the aspx. Here is the code snippet in VB.
VB:
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) |
If e.CommandName = "Update" Then |
End If |
End Sub |
Thanks
Shinu.
0
Alice
Top achievements
Rank 1
answered on 27 Aug 2008, 11:46 PM
Thanks, I think I have it. :) I really appreciated the help.
0
Shinu
Top achievements
Rank 2
answered on 28 Aug 2008, 03:45 AM
Hi Alice,
You can use the following link to convert code from C# to VB and viceversa.
http://converter.telerik.com/
Regards
Shinu
You can use the following link to convert code from C# to VB and viceversa.
http://converter.telerik.com/
Regards
Shinu
0
0
Alice
Top achievements
Rank 1
answered on 06 Sep 2008, 03:08 PM
That was a great vid thanks.
Well guys,
Everything is working perfect except insert. Here is what I have in the code:
Well guys,
Everything is working perfect except insert. Here is what I have in the code:
Private Sub RadGridGoals_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridGoals.ItemCommand
Select e.CommandName
Case e.CommandName = "Update"
Me.ObjectDataSourceGoals.Update()
Case e.CommandName = "Cancel"
Me.RadGridGoals.Rebind()
End Select
End Sub
Here's what I tried:
Private Sub RadGridGoals_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridGoals.ItemCommand
Select e.CommandName
Case e.CommandName = "Update"
Me.ObjectDataSourceGoals.Update()
Case e.CommandName = "Cancel"
Me.RadGridGoals.Rebind()
Case e.CommandName = "Insert"
Me.ObjectDataSourceGoals.Insert()
End Select
End Sub
Any suggestions?
0
Hello Alice,
Based on the code supplied, it is hard to determine the cause of the issue. To further investigate it, you can open a formal support ticket, and send us a small project sample, for additional testing.
Sincerely yours,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Based on the code supplied, it is hard to determine the cause of the issue. To further investigate it, you can open a formal support ticket, and send us a small project sample, for additional testing.
Sincerely yours,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.