This is a migrated thread and some comments may be shown as answers.

detail grid is not refreshing.

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 07 Jun 2012, 10:19 PM
When I click on a row in master grid , the detail grid does not refresh. Please help me. thanks

        protected void OnLogGridNeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            var logs = LogManager.FindLog();
 
            var sortedlogs = from l in logs
                             orderby l.LogId descending
                             select l;
 
            grdLogGrid.DataSource = sortedlogs;
 
        }
 
        protected void OnLogDetailGridNeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            int logid = 0;
            grdLogDetailGrid.DataSource = null;
            
            if (grdLogGrid.SelectedValue != null)
                logid = Convert.ToInt32(grdLogGrid.SelectedValue.ToString());
 
 
            var logDetails = LogManager.FindLogDetail();
            var logDetail = from ld in logDetails
                            where ld.LogId == logid
                            select ld;
 
            grdLogDetailGrid.DataSource = logDetail;
 
        }
 
 
 
        protected void OnLogGridSelectedIndexChanged(object sender, EventArgs e)
        {
            int logid = Convert.ToInt32(grdLogGrid.SelectedValue.ToString());
 
            var logDetails = LogManager.FindLogDetail();
            var logDetail = from ld in logDetails
                            where ld.LogId == logid
                            select ld;
 
            grdLogDetailGrid.DataSource = logDetail;
 
        }










	<telerik:RadAjaxManagerProxy ID="AjaxProxy" runat="server">
		<AjaxSettings>
			<telerik:AjaxSetting AjaxControlID="grdLogGrid">
				<UpdatedControls>
					<telerik:AjaxUpdatedControl ControlID="grdLogGrid" />
				</UpdatedControls>
			</telerik:AjaxSetting>
		</AjaxSettings>
	</telerik:RadAjaxManagerProxy>
	
	<telerik:RadGrid 
		ID="grdLogGrid" 
		runat="server"
		OnNeedDataSource="OnLogGridNeedDataSource"
		AllowFilteringByColumn="true"
		AllowPaging="true"
		AllowSorting="true"
		GroupingEnabled="true"
		ShowGroupPanel="true" 
        onselectedindexchanged="OnLogGridSelectedIndexChanged">
		<MasterTableView
			DataKeyNames="LogId">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
            </EditFormSettings>
		</MasterTableView>
		<ClientSettings 
			AllowColumnsReorder="true"
			AllowDragToGroup="true"
			AllowGroupExpandCollapse="true"
			ColumnsReorderMethod="Reorder"
			EnableRowHoverStyle="true" EnablePostBackOnRowClick="True"
			>
			<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" />
			<Selecting AllowRowSelect="true"  /> 
			             
		</ClientSettings>
		<GroupingSettings ShowUnGroupButton="true" />             
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
	</telerik:RadGrid>
 
    <br />
    <strong>Log Details</strong>
 
    <br />
	<telerik:RadGrid 
		ID="grdLogDetailGrid" 
		runat="server"
		OnNeedDataSource="OnLogDetailGridNeedDataSource"
		AllowFilteringByColumn="true"
		AllowPaging="true"
		AllowSorting="true"
		GroupingEnabled="true"
		ShowGroupPanel="true">
		<MasterTableView
			GroupLoadMode="Client">
		</MasterTableView>
		<ClientSettings 
			AllowColumnsReorder="true"
			AllowDragToGroup="true"
			AllowGroupExpandCollapse="true"
			ColumnsReorderMethod="Reorder"
			EnableRowHoverStyle="true"
			>
			<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" />
			<Selecting AllowRowSelect="true"  /> 
			             
		</ClientSettings>
		<GroupingSettings ShowUnGroupButton="true" />             
 
	</telerik:RadGrid>


1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 08 Jun 2012, 03:11 PM
Hi John,

The online demo below demonstrates how the desired functionality can be achieved:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx

Give it a try and see what is the difference in your case.
 
Regards,
Pavlina
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.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or