hi ,
I am using rad controld for asp.net ajax and use radgrid for self reference heirarchy. All working nice.
But now i want to hide the built in collapse / expand button when not have child view in the row. How can i achive this?
I am using rad controld for asp.net ajax and use radgrid for self reference heirarchy. All working nice.
But now i want to hide the built in collapse / expand button when not have child view in the row. How can i achive this?
15 Answers, 1 is accepted
0

Akhil Raj
Top achievements
Rank 1
answered on 05 Feb 2010, 07:16 AM
i solved the problem..
0

Balu
Top achievements
Rank 2
answered on 08 Aug 2012, 02:25 PM
hi Akhil Raj
my requirement also same as of you,can you please share your code ?
my requirement also same as of you,can you please share your code ?
0

Akhil Raj
Top achievements
Rank 1
answered on 09 Aug 2012, 01:22 AM
hi,
Can you look into the following article
http://www.telerik.com/support/kb/winforms/gridview/hide-expand-collapse-image-in-hierarchical-radgridview.aspx
Can you look into the following article
http://www.telerik.com/support/kb/winforms/gridview/hide-expand-collapse-image-in-hierarchical-radgridview.aspx
0

Shinu
Top achievements
Rank 2
answered on 09 Aug 2012, 04:56 AM
Hi Bala,
Try the following code in PreRender event to hide expand collapse button when there are no records in self referencing hierarchy.
C#:
Thanks,
Shinu.
Try the following code in PreRender event to hide expand collapse button when there are no records in self referencing hierarchy.
C#:
protected
void
RadGrid1_PreRender(
object
sender, System.EventArgs e)
{
RemoveExpandIconWhenNoRecords(RadGrid1.MasterTableView);
}
protected
void
RemoveExpandIconWhenNoRecords(GridTableView view)
{
if
(view.Controls.Count > 0)
{
foreach
(GridItem item
in
view.Controls[0].Controls)
{
if
(item
is
GridNestedViewItem)
{
GridNestedViewItem nestedViewItem = (GridNestedViewItem)item;
if
(nestedViewItem.NestedTableViews[0].Items.Count == 0)
{
TableCell cell = nestedViewItem.NestedTableViews[0].ParentItem[
"ExpandColumn"
];
cell.Controls[0].Visible =
false
;
cell.Text =
" "
;
nestedViewItem.Visible =
false
;
}
else
{
RemoveExpandIconWhenNoRecords(nestedViewItem.NestedTableViews[0]);
}
}
}
}
}
Thanks,
Shinu.
0

Balu
Top achievements
Rank 2
answered on 09 Aug 2012, 08:11 AM
Thank you for your quick reply,
My Requirement is i have One Grid say RadGrid1 , inside of RadGrid1 i have taken one more Grid as a GridTableView.
here my my question is how i will provide paging and Colloapse/Expand functionality for GridTableView (to inner grid).
My Requirement is i have One Grid say RadGrid1 , inside of RadGrid1 i have taken one more Grid as a GridTableView.
here my my question is how i will provide paging and Colloapse/Expand functionality for GridTableView (to inner grid).
0

Shinu
Top achievements
Rank 2
answered on 10 Aug 2012, 05:58 AM
Hi,
You can set AllowPaging and ExpandCollapse column for the DetailTable as shown below.
aspx:
Thanks,
Shinu.
You can set AllowPaging and ExpandCollapse column for the DetailTable as shown below.
aspx:
<
DetailTables
>
<
telerik:GridTableView
AllowPaging
=
"true"
PageSize
=
"4"
AutoGenerateColumns
=
"false"
ExpandCollapseColumn-Display
=
"true"
DataKeyNames
=
"OrderID"
>
. . .
</
telerik:GridTableView
>
</
DetailTables
>
Thanks,
Shinu.
0

Balu
Top achievements
Rank 2
answered on 10 Aug 2012, 08:00 AM
thanks all for quick response
http://www.dotnetspeaks.com/LiveDemos/ASP.NET/GridView/NestedGridViewPaging.aspx
please check above link.i want same functionality using Netsed Rad Grid Views (both paging and expand and collapse functionality)
http://www.dotnetspeaks.com/LiveDemos/ASP.NET/GridView/NestedGridViewPaging.aspx
please check above link.i want same functionality using Netsed Rad Grid Views (both paging and expand and collapse functionality)
0

Shinu
Top achievements
Rank 2
answered on 13 Aug 2012, 05:13 AM
Hi,
Try the following code to show paging in inner grid. Also take a look into this demo.
aspx:
Thanks,
Shinu.
Try the following code to show paging in inner grid. Also take a look into this demo.
aspx:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
DataSourceID
=
"SqlDataSource1"
>
<
MasterTableView
DataKeyNames
=
"CustomerID"
CommandItemDisplay
=
"Top"
>
<
NestedViewSettings
DataSourceID
=
"SqlDataSource2"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
MasterKeyField
=
"CustomerID"
DetailKeyField
=
"CustomerID"
/>
</
ParentTableRelation
>
</
NestedViewSettings
>
<
Columns
>
. . .
</
Columns
>
<
NestedViewTemplate
>
<
telerik:RadGrid
AllowPaging
=
"true"
PageSize
=
"2"
ID
=
"RadGrid2"
runat
=
"server"
AutoGenerateColumns
=
"false"
DataSourceID
=
"SqlDataSource2"
>
<
MasterTableView
DataKeyNames
=
"OrderID"
>
<
Columns
>
. . .
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
NestedViewTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Shinu.
0

Khaja
Top achievements
Rank 1
answered on 31 Aug 2012, 08:25 AM
i have a nested grid view with in a gridview,my problem is when i am firing textchanged event in nested gridview nested grid view is collapsing with master gridview,how to show nested gridview after the event is fired.
Thanks in advance
Naseer
Thanks in advance
Naseer
0
Hi Khaja,
I have created a sample RadGrid web site to test the described approach. On my side everything works as expected and the grid's expanded state is correctly preserved. Please check out the attached application and try to distinguish the crucial differences between our projects.
Greetings,
Eyup
the Telerik team
I have created a sample RadGrid web site to test the described approach. On my side everything works as expected and the grid's expanded state is correctly preserved. Please check out the attached application and try to distinguish the crucial differences between our projects.
Greetings,
Eyup
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.
0

Khaja
Top achievements
Rank 1
answered on 04 Sep 2012, 10:04 AM
thank you for your reply
I placed my code on update panel so its getting merging,if i removing update panel every time refresh is happening,how to solve it
thanks in advance,
Naseer
I placed my code on update panel so its getting merging,if i removing update panel every time refresh is happening,how to solve it
<
div
class
=
"rnd1"
>
<
asp:UpdatePanel
ChildrenAsTriggers
=
"true"
UpdateMode
=
"Conditional"
ID
=
"UpdatePanel2"
runat
=
"server"
>
<
ContentTemplate
>
<
asp:GridView
ID
=
"grdQuotMaster"
AllowPaging
=
"True"
ExpandCollapseColumn-Display
=
"true"
BackColor
=
"#f1f1f1"
Width
=
"100%"
CssClass
=
"GridViewStyle"
AutoGenerateColumns
=
"false"
DataKeyNames
=
"QuotId"
Style
=
"z-index: 101; left: 8px;"
Font-Size
=
"Small"
Font-Names
=
"Verdana"
runat
=
"server"
GridLines
=
"None"
OnRowCommand
=
"grdQuotMaster_RowCommand"
OnRowDataBound
=
"grdQuotMaster_RowDataBound"
AllowSorting
=
"true"
OnSelectedIndexChanging
=
"grdQuotMaster_SelectedIndexChanging"
OnPageIndexChanging
=
"grdQuotMaster_PageIndexChanging"
>
<
RowStyle
BackColor
=
"#E3EAEB"
/>
<
AlternatingRowStyle
BackColor
=
"White"
/>
<
PagerStyle
CssClass
=
"PagerStyle"
/>
<
SelectedRowStyle
BackColor
=
"#A2DDDA"
/>
<
HeaderStyle
ForeColor
=
"White"
Font-Bold
=
"true"
CssClass
=
"HeaderStyle"
/>
<
FooterStyle
BackColor
=
"White"
/>
<
Columns
>
<
asp:CommandField
ButtonType
=
"Image"
SelectImageUrl
=
"~/images/GSel.gif"
ShowCancelButton
=
"False"
ShowSelectButton
=
"True"
SelectText
=
"Edit"
ItemStyle-Width
=
"15px"
>
<
ItemStyle
Width
=
"15px"
></
ItemStyle
>
</
asp:CommandField
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
a
href
=
"javascript:expandcollapse('div<%# Eval("
QuotId") %>', 'one');">
<
img
id
=
"imgdiv<%# Eval("
QuotId") %>" alt="Click to show/hide Orders for Customer <%# Eval("QuotId") %>"
width="9px" border="0" src="images/plus.gif" />
</
a
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
HeaderText
=
"Quotation.No"
DataField
=
"QuotId"
></
asp:BoundField
>
<
asp:BoundField
HeaderText
=
"Enquiry.No"
DataField
=
"enqId"
></
asp:BoundField
>
<
asp:TemplateField
HeaderText
=
"Customer ID"
Visible
=
"false"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblCustId"
Text='<%# Eval("custId") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
HeaderText
=
"CustomerName"
DataField
=
"custname"
></
asp:BoundField
>
<
asp:BoundField
HeaderText
=
"Quotation Date"
DataField
=
"QuotDate"
DataFormatString
=
"{0:dd/MM/yyyy}"
>
</
asp:BoundField
>
<
asp:BoundField
HeaderText
=
"Amount"
DataField
=
"Amount"
></
asp:BoundField
>
<
asp:BoundField
HeaderText
=
"Status"
DataField
=
"Status"
></
asp:BoundField
>
<
asp:ButtonField
ButtonType
=
"button"
CommandName
=
"Stop"
Text
=
"Stop"
/>
<
asp:ButtonField
ButtonType
=
"button"
CommandName
=
"Print"
Text
=
"Print"
/>
<
asp:ButtonField
ButtonType
=
"button"
CommandName
=
"Email"
Text
=
"Email"
/>
<
asp:TemplateField
>
<
ItemTemplate
>
<
tr
>
<
td
colspan
=
"100%"
>
<
asp:UpdatePanel
ChildrenAsTriggers
=
"true"
ID
=
"UpdatePanel2"
UpdateMode
=
"Conditional"
runat
=
"server"
>
<
ContentTemplate
>
<
div
id
=
"div<%# Eval("
QuotId") %>" style="display: none; position: relative; left: 15px;
overflow: auto; width: 97%" class="rnd1">
<
asp:GridView
ID
=
"grdQuotDetails"
AllowPaging
=
"True"
AllowSorting
=
"true"
BackColor
=
"White"
Width
=
"100%"
CssClass
=
"GridViewStyle "
AutoGenerateColumns
=
"false"
Font-Names
=
"Verdana"
ExpandCollapseColumn-Display
=
"true"
runat
=
"server"
DataKeyNames
=
"QuotId"
ShowFooter
=
"true"
OnPageIndexChanging
=
"grdQuotDetails_PageIndexChanging"
OnRowUpdating
=
"grdQuotDetails_RowUpdating"
OnRowCommand
=
"grdQuotDetails_RowCommand"
OnRowEditing
=
"grdQuotDetails_RowEditing"
GridLines
=
"None"
OnRowUpdated
=
"grdQuotDetails_RowUpdated"
OnRowCancelingEdit
=
"grdQuotDetails_CancelingEdit"
OnRowDataBound
=
"grdQuotDetails_RowDataBound"
OnRowDeleting
=
"grdQuotDetails_RowDeleting"
OnRowDeleted
=
"grdQuotDetails_RowDeleted"
OnSorting
=
"grdQuotDetails_Sorting"
>
<
RowStyle
BackColor
=
"#E3EAEB"
/>
<
AlternatingRowStyle
BackColor
=
"White"
/>
<
HeaderStyle
ForeColor
=
"White"
CssClass
=
"HeaderStyle"
/>
<
FooterStyle
BackColor
=
"White"
/>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"QuotDetID"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblQuotDetID"
Text='<%# Eval("QuotDetID") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Label
ID
=
"lblQuotDetID"
Text='<%# Eval("QuotDetID") %>' runat="server"></
asp:Label
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"ProdId"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblProdId"
Text='<%# Eval("ProdId") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Label
ID
=
"lblProdId"
Text='<%# Eval("ProdId") %>' runat="server"></
asp:Label
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"UOM"
>
<
ItemTemplate
>
<%# Eval("Packetsize")%></
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtPacketsize"
Text='<%# Eval("Packetsize")%>' runat="server" Width="50%"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Qty"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblQuantity"
Text='<%# Eval("Quantity")%>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtQuantity"
Text='<%# Eval("Quantity")%>' runat="server" AutoPostBack="true"
OnTextChanged="txtQuantity_TextChanged" Width="50%" onkeypress="update"></
asp:TextBox
>
<
asp:UpdatePanel
ID
=
"UpdatePanel1"
UpdateMode
=
"Conditional"
runat
=
"server"
ChildrenAsTriggers
=
"true"
>
<
ContentTemplate
>
<
asp:TextBox
ID
=
"txtQuantity"
Text='<%# Eval("Quantity")%>' runat="server" AutoPostBack="true"
OnTextChanged="txtQuantity_TextChanged" Width="50%" onkeypress="update"></
asp:TextBox
>
</
ContentTemplate
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"txtQuantity"
EventName
=
"TextChanged"
/>
</
Triggers
>
</
asp:UpdatePanel
>--%>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Price"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblSalesprice"
Text='<%# Eval("salesPrice")%>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtsalesPrice"
Text='<%# Eval("salesPrice")%>' runat="server" AutoPostBack="true"
OnTextChanged="txtsalesPrice_TextChanged" Width="75%"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Amount"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblAmount"
Text='<%# Eval("Amount") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtAmount"
Text='<%# Eval("Amount") %>' runat="server" Width="75%"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"InstallationRate"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblInstallationRate"
Text='<%# Eval("InstallationRate") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtInstallationRate"
Text='<%# Eval("InstallationRate") %>' runat="server"
Width="50%" AutoPostBack="true" OnTextChanged="txtInstallationRate_TextChanged"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"InstallationAmount"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblIstallationAmt"
Text='<%# Eval("InstallationAmount") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtIstallationAmt"
Text='<%# Eval("InstallationAmount") %>' runat="server"
Width="50%"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"InstallationTaxAmount"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblIstallationTaxAmt"
Text='<%# Eval("IstallationTaxAmt") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtIstallationTaxAmt"
Text='<%# Eval("IstallationTaxAmt") %>' runat="server"
Width="50%"></
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"ProductTaxAmount"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblproducttaxamt"
Text='<%# Eval("ProductTaxAmt") %>' runat="server"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtproducttaxamt"
Text='<%# Eval("ProductTaxAmt") %>' runat="server"
Width="75%"></
asp:TextBox
>
</
EditItemTemplate
>
<
FooterTemplate
>
<
asp:LinkButton
ID
=
"linkAddOrder"
CommandName
=
"AddOrder"
runat
=
"server"
>Add</
asp:LinkButton
>
<
asp:ImageButton
ID
=
"imgbtnAdd"
runat
=
"server"
CausesValidation
=
"true"
ImageUrl
=
"~/Images/insert.jpg"
CommandName
=
"AddOrder"
ToolTip
=
"Add"
Height
=
"20px"
Width
=
"20px"
/>
</
FooterTemplate
>--%>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"imgbtnEdit"
CommandName
=
"Edit"
runat
=
"server"
ImageUrl
=
"~/Images/edit.jpg"
ToolTip
=
"Edit"
Height
=
"20px"
Width
=
"20px"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:ImageButton
ID
=
"imgbtnUpdate"
CommandName
=
"Update"
runat
=
"server"
CausesValidation
=
"true"
ImageUrl
=
"~/Images/update.jpg"
ToolTip
=
"Update"
Height
=
"20px"
Width
=
"20px"
/>
<
asp:ImageButton
ID
=
"imgbtnCancel"
runat
=
"server"
CommandName
=
"Cancel"
ImageUrl
=
"~/images/cancel2.png"
ToolTip
=
"Cancel"
Height
=
"20px"
Width
=
"20px"
/>
</
EditItemTemplate
>
<
ItemStyle
Width
=
"60px"
/>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
</
div
>
</
ContentTemplate
> </
asp:UpdatePanel
>
</
td
>
</
tr
>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
div
>
Naseer
0
Hello Khaja,
Please note that when you have declared AutoPostBack=true to your controls, their events will cause a regular postbacks to the server.
It is difficult to figure out your exact requirements by the provided information so far. Could you please elaborate some more on what you want to achieve?
Kind regards,
Eyup
the Telerik team
Please note that when you have declared AutoPostBack=true to your controls, their events will cause a regular postbacks to the server.
It is difficult to figure out your exact requirements by the provided information so far. Could you please elaborate some more on what you want to achieve?
Kind regards,
Eyup
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.
0

Khyati
Top achievements
Rank 1
answered on 20 Mar 2013, 05:32 AM
hello,
I use nested grid and checkbox in radgrid in my website.. and i m trying to expand nested grid on checkbox checkedchanged event..
but on checkedchange event i can't find control of panel which is in nested grid..
Anybody can please help me....
I use nested grid and checkbox in radgrid in my website.. and i m trying to expand nested grid on checkbox checkedchanged event..
but on checkedchange event i can't find control of panel which is in nested grid..
Anybody can please help me....
0

Princy
Top achievements
Rank 2
answered on 20 Mar 2013, 06:05 AM
HI,
Try the following code to access Panel in NestedViewTemplate.
C#:
Thanks,
Princy
Try the following code to access Panel in NestedViewTemplate.
C#:
protected
void
CheckBox1_CheckedChanged(
object
sender, EventArgs e)
{
foreach
(GridNestedViewItem item
in
RadGrid1.MasterTableView.GetItems(GridItemType.NestedView))
{
Panel pnl = (Panel)item.FindControl(
"Panel1"
);
}
}
Thanks,
Princy
0

Eldhose
Top achievements
Rank 1
Iron
answered on 20 Feb 2023, 06:15 AM
| edited on 20 Feb 2023, 06:17 AM
Hi
How to find Button inside detailed table view(NestedGridview) of a Gridview and show or visible the controls inside detailed table(NestedGridview) based on the row value in c#
Rumen
commented on 22 Feb 2023, 04:10 AM
Telerik team
Hi there,
You can review the following resources with code snippets on the matter: