Hello,
Could someone show me to add a button/hyperlink on the 2nd level? I see you have the sample in the link below, but I only need to add a button/hyperlink on the child table.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx
Many Thanks!!!!
Could someone show me to add a button/hyperlink on the 2nd level? I see you have the sample in the link below, but I only need to add a button/hyperlink on the child table.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx
Many Thanks!!!!
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 15 Mar 2012, 05:32 AM
Hello,
The following code snippet shows how to add Button in Detail table . You can try adding a Button in GridTemplateColumn or can use GridButtonColumn for this purpose.
ASPX:
Thanks,
Princy.
The following code snippet shows how to add Button in Detail table . You can try adding a Button in GridTemplateColumn or can use GridButtonColumn for this purpose.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
>
<
MasterTableView
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"CustomerID"
HierarchyDefaultExpanded
=
"true"
>
<
DetailTables
>
<
telerik:GridTableView
DataSourceID
=
"SqlDataSource2"
DataKeyNames
=
"OrderID"
runat
=
"server"
Name
=
"DetailTable1"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"CustomerID"
MasterKeyField
=
"CustomerID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"GridButtonColumn1"
ButtonType
=
"PushButton"
Text
=
"GridButtonColumn1"
>
</
telerik:GridButtonColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"Button"
HeaderText
=
"Button"
>
<
ItemTemplate
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"CustomerID"
HeaderText
=
"CustomerID"
DataField
=
"CustomerID"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Princy.
0

Newkid
Top achievements
Rank 1
answered on 15 Mar 2012, 03:03 PM
Princy,
Thanks for your reply. I think i wasnot clear on my question. What i want to display a "Add New Record" button (or link) under need of my child table (see my attached file). When i click on this button/link, i will go to another page.
I have tried different way but i couldn't make it work. Do you have any ideas? Thanks so much!!!!
Thanks for your reply. I think i wasnot clear on my question. What i want to display a "Add New Record" button (or link) under need of my child table (see my attached file). When i click on this button/link, i will go to another page.
I have tried different way but i couldn't make it work. Do you have any ideas? Thanks so much!!!!
0
Accepted

Princy
Top achievements
Rank 2
answered on 16 Mar 2012, 05:30 AM
Hello,
You can add a FooterTemplate in the GridTemplateColumn of the DetailTables. See the following code snippet.
aspx:
CSS:
Hope this helps.
Thanks,
Princy.
You can add a FooterTemplate in the GridTemplateColumn of the DetailTables. See the following code snippet.
aspx:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
>
<
MasterTableView
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"ProjectID"
HierarchyDefaultExpanded
=
"true"
>
<
DetailTables
>
<
telerik:GridTableView
DataSourceID
=
"SqlDataSource2"
DataKeyNames
=
"RequestStatus"
runat
=
"server"
ShowFooter
=
"true"
Name
=
"DetailTable1"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"CustomerID"
MasterKeyField
=
"ProjectID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"RequestStatus"
HeaderText
=
"Request Status"
DataField
=
"RequestStatus"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Reason"
HeaderText
=
"Reason"
DataField
=
"Reason"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Other Reason"
HeaderText
=
"Other Reason"
DataField
=
"Other Reason"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
>
<
FooterTemplate
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Add New Record"
/>
</
FooterTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"ProjectID"
HeaderText
=
"Project ID"
DataField
=
"ProjectID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"prj_status"
HeaderText
=
"prj_status"
DataField
=
"prj_status"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Title"
HeaderText
=
"Title"
DataField
=
"Title"
></
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<style type=
"text/css"
>
.RadGrid_Default .rgFooter td
{
float
:
left
!important
;
}
</style>
Thanks,
Princy.
0

Raj
Top achievements
Rank 1
answered on 01 Apr 2012, 04:03 PM
I am creating radgrid by programatically and i created CommandItemTemplate for AddNewRecord created,for that i need to assign the blue
color for the link button, please let me know.
Thanks,
Raj
color for the link button, please let me know.
Thanks,
Raj
0

Princy
Top achievements
Rank 2
answered on 02 Apr 2012, 06:29 AM
Hello Raj,
Try the following code to assigning color for linkbutton.
C#:
Thanks,
Princy.
Try the following code to assigning color for linkbutton.
C#:
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridCommandItem)
{
GridCommandItem item = (GridCommandItem)e.Item;
LinkButton link = (LinkButton)item.FindControl(
"LinkButtonId"
);
link.ForeColor = System.Drawing.Color.Blue;
}
}
Thanks,
Princy.