Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
WebDataGrid EnableDataViewState with ObjectDataSource
posted

Experts, there is something very basic I'm missing here. I've read literally hundreds of posts of similar questions, and I'm still not understanding.

I have a WebDataGrid using an ObjectDataSource for its data.  On the initial page load as well as every postback, the Selecting event of the ObjectDataSource is being fired, therefore calling SQL Server for new data.  I thought by setting the EnableDataViewState='true", the grid would not request data on a postback unless I told it to.  I can't determine if the grid is actually requesting data, or is the selecting event of the ObjectDataSource is firing by itself.  I've tried several scenarios with, and without an update panel, but can't seem to figure out how to get the ObjectDataSource from selecting data on a PostBack, or an Ajax PostBack until I want it to.

I've tried regular ObectDataSource parameters, as well as session parameters to no avail.

On the production code I have several update panels, with several grids. Every time there is a postback, all the ObjectDataSources are requesting data causing significant performance issues.

Any ideas of what I'm missing?

Thanks

Simple Example

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="CommitmentBooksPortal.test" %>
 
<%@ Register Assembly="Infragistics45.Web.v17.2, Version=17.2.20172.1006, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
 
<%@ Register Assembly="Infragistics45.Web.v17.2, Version=17.2.20172.1006, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.LayoutControls" TagPrefix="ig" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 
    <asp:Button ID="Button1" runat="server" Text="PostBack" OnClick="Button1_Click" />
 
    <ig:WebDataGrid ID="WebDataGridStoreFilter" runat="server" Height="470px" Width="400px"  DataKeyFields="Sys_ID" AutoGenerateColumns="False" DataSourceID="ObjectDataSourceStoreFilter" ShowFooter="false" EnableAjax="false" EnableAjaxViewState="false" EnableViewState="true" EnableDataViewState="true">
        <AjaxIndicator Enabled="false" />
        <Columns>
            <ig:BoundDataField Key="Sys_ID" DataFieldName="Sys_ID" Hidden="true">
                <Header Text="SYS_ID"></Header>
            </ig:BoundDataField>
            <ig:BoundCheckBoxField CssClass="FilterCheckBox" Key="Filter" DataFieldName="Filter">
                <Header Text="FIL"></Header>
            </ig:BoundCheckBoxField>
            <ig:BoundDataField Key="Store_Num" DataFieldName="Store_Num" Width="50px" CssClass="filterFieldStoreNum">
                <Header Text="Store"></Header>
            </ig:BoundDataField>
            <ig:BoundDataField Key="Store_Name" DataFieldName="Store_Name" Width="250px">
                <Header Text="Name"></Header>
            </ig:BoundDataField>
        </Columns>
        <Behaviors>
            <ig:EditingCore Enabled="true" BatchUpdating="true">
                <EditingClientEvents />
                <Behaviors>
                    <ig:CellEditing Enabled="true">
                        <ColumnSettings>
                            <ig:EditingColumnSetting ReadOnly="false" ColumnKey="Filter" />
                        </ColumnSettings>
                    </ig:CellEditing>
                </Behaviors>
            </ig:EditingCore>
        </Behaviors>
    </ig:WebDataGrid>
 
    <asp:ObjectDataSource ID="ObjectDataSourceStoreFilter" runat="server" SelectMethod="selectStoreFilter" TypeName="CommitmentBooksPortal.clsDefaultDataAccessLayer" UpdateMethod="updateStoreFilter" OnSelecting="ObjectDataSourceStoreFilter_Selecting">
        <SelectParameters>
            <asp:Parameter Name="UserId" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Sys_ID" Type="Int32" />
            <asp:Parameter Name="Filter" Type="Boolean" />
        </UpdateParameters>
    </asp:ObjectDataSource>
 
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace CommitmentBooksPortal
{
    public partial class test : basepage
    {
 
        protected void Page_Load(object sender, EventArgs e)
        {
                        
 
        }
        
        protected void ObjectDataSourceStoreFilter_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            clsCommonClassWrapper clsCCW = (clsCommonClassWrapper)HttpContext.Current.Session["clsCCW"];
            if (clsCCW == null) { clsCCW = new clsCommonClassWrapper(); }
            e.InputParameters["UserId"= clsCCW.clsIAS.UserId;
        }
 
        protected void Button1_Click(object sender, EventArgs e)
        {
 
        }
    }
}


Parents Reply Children
No Data