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

RadGrid Problem

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 24 Aug 2011, 06:31 PM
Hello,

i'm having a problem with my RadGrid, At this moment i need to bind data to my Grid using 2 diferent Store Procedures, mapped on my .edmx.

The idea is to have two buttons, each one to call a procedure. At this moment My problem is when I click on a collumn to sort data, my grid comes blank....I need to allow my RadGrid to sort collumns but for the specific procedure that was bind at last.

How can i do that?

My code is

public partial class InvoicesScalingDefault : iConnect.Web.iConnect, IInvoicesScale
    {
        private InvoicesScalePresenter _presenter;
  
        public System.Collections.Generic.IList<Data.SapDocuments> SapDocuments
        {
            get;
            set;
        }
  
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
  
                this._presenter.OnViewInitialized();
  
                LoadData();
            }
            this._presenter.OnViewLoaded();
  
        }
  
        [CreateNew]
        public InvoicesScalePresenter Presenter
        {
            set
            {
                this._presenter = value;
                this._presenter.View = this;
            }
        }
  
  
        /// <summary>
        /// Carregar RadGrid1 com o objecto SapDocuments 
        /// </summary>
        private void LoadData()
        {
  
            string user = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\\") + 1);
  
            EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
            RadGrid1.DataSource = objectContx.ShowUnprocessedInvoices(user);
            //RadGrid1.DataBind();
  
        }
  
  
protected void RadGrid1_GridExporting(object sender, GridExportingArgs e)
        {
            e.ExportOutput = e.ExportOutput.Replace("\"\r\n\"", "\"\r\n\"'");
        }
  
protected void ShowProcessed_Click(object sender, EventArgs e)
        {
            string user = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\\") + 1);
  
            EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
            RadGrid1.DataSource = objectContx.ShowProcessedInvoices(user);
            RadGrid1.DataBind();
  
  
        }
  
  
        protected void ShowUnProcessed_Click(object sender, EventArgs e)
        {
            LoadData();
  
        }

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 Aug 2011, 05:38 AM
Hello Ricardo,

RadGird does not support advanced features like sorting, paging etc when you are using SimpleDataBinding. Make sure that you use Advanced data binding using NeedDataSource event. Check the following help documentation which explains more about this.
Advanced Data-binding (using NeedDataSource event).

Thanks,
Princy.
0
Ricardo
Top achievements
Rank 1
answered on 25 Aug 2011, 11:29 AM

Hello,

if i use ViewState to keep both two datasource i can solve it??

Last Code

protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
  
                this._presenter.OnViewInitialized();
  
                string user = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\\") + 1);
                EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
                ViewState["Data"] = objectContx.ShowUnprocessedInvoices(user);
                RadGrid1.DataSource = objectContx.ShowUnprocessedInvoices(user);
                RadGrid1.DataBind();
  
  
            }
            this._presenter.OnViewLoaded();
  
            RadGrid1.DataSource = (ShowUnprocessedInvoices_Result)ViewState["Data"];
            RadGrid1.DataBind();
  
        }
  
  
protected void ShowProcessed_Click(object sender, EventArgs e)
        {
            string user = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\\") + 1);
  
            EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
            RadGrid1.DataSource = objectContx.ShowProcessedInvoices(user);
            RadGrid1.DataBind();
  
            ViewState["Data"] = objectContx.ShowProcessedInvoices(user);
  
        }
  
  
        protected void ShowUnProcessed_Click(object sender, EventArgs e)
        {
            string user = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\\") + 1);
  
            EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
            RadGrid1.DataSource = objectContx.ShowUnprocessedInvoices(user);
            RadGrid1.DataBind();
  
            ViewState["Data"] = objectContx.ShowUnprocessedInvoices(user);
  
        }
0
Ricardo
Top achievements
Rank 1
answered on 25 Aug 2011, 06:37 PM
I have solved the problem using ViewState however know

I have a problem on my RadGrid1. two of the grid columns are navigation properties...The problem is when i enter on the page, all columns fields has data.But when i click to sort those two columns came without values..
 
I have already verify that the list i'm using as DataSource, has allways those two columns with values...The problem is that when i sort the Grid comes without values on "Priority" and "Process" fields.....
 
Tags
Grid
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ricardo
Top achievements
Rank 1
Share this question
or