473,594 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load data into grid

3 New Member
I'm having serious problems loading data into a grid, i've encountered a number of problems, which i´ve beem solving through different approachs, and now i dont found any issue, but i still cant load the data into the grid. The data is filtered in a external comboBox (rdpInvestigado r).

I use a n-layer architecture with ASP Object Data Source. i'm sharing the critical part of the code not to overextend the post.

//HTML

Expand|Select|Wrap|Line Numbers
  1. <telerik:RadComboBox ID="rdpInvestigador" runat="server" EmptyMessage=" - escolher - " AutoPostBack="true"  EnableLoadOnDemand="true"      </telerik:RadComboBox>
  2. <telerik:RadButton ID="ButtonPerformSearch" Text="Aceder à listagem de timesheets" ValidationGroup="search" OnClick="ButtonPerformSearch_Click"
  3.                     runat="server"  CssClass="btn btn-mini"  Width="50%" ButtonType="ToggleButton"
  4.                    CausesValidation="true"></telerik:RadButton>
  5.  <asp:LinkButton ID="lkbPesquisar" runat="server" CssClass="btn btn-mini" OnClick="lkbPesquisar_Click">pesquisar</asp:LinkButton>
  6.  
  7. <asp:ObjectDataSource ID="DataSourceTimesheets" runat="server" EnablePaging="True" OnSelecting="DataSourceTimesheets_Selecting" SortParameterName="sortType" TypeName="UMinho.GestaoProjectos.BLL.BLLListagemTimesheets" 
  8.                    SelectMethod="GetList" SelectCountMethod="GetListCount">
  9.  
  10.                     <SelectParameters>
  11.  
  12.                          <asp:ControlParameter ControlID="rdpInvestigador" Name="IDRecursoHumano" PropertyName="SelectedValue" DefaultValue="" Type="Int32" />
  13.  
  14.                          <asp:Parameter  Name="ID"  Type="Int32" />
  15.  
  16.                         <asp:Parameter  Name="DataEnvio"  Type="datetime"  />
  17.  
  18.                          <asp:Parameter  Name="IDEstadoTimesheet"  Type="Int32" />
  19.  
  20.                          <asp:Parameter  Name="AssinaturaTimesheet"  Type="string" />
  21.  
  22.                           <asp:Parameter  Name="Observações"  Type="string" />
  23.  
  24.                           <asp:Parameter  Name="Ficheiro"  Type="string" />
  25.  
  26.                           <asp:Parameter  Name="FileTipo"  Type="string" />
  27.  
  28.                          <asp:Parameter  Name="FileContent" Type="Byte"   />
  29.  
  30.                         <asp:Parameter Name="login" Type="String" />
  31.  
  32.  
  33.                     </SelectParameters>
  34.                 </asp:ObjectDataSource>
I'm having serious problems loading data into a grid, i've encountered a number of problems, which i´ve beem solving through different approachs, and now i dont found any issue, but i still cant load the data into the grid. The data is filtered in a external comboBox (rdpInvestigado r).

I use a n-layer architecture with ASP Object Data Source. i'm sharing the critical part of the code not to overextend the post

//HTML

<telerik:RadCom boBox ID="rdpInvestig ador" runat="server" EmptyMessage=" - escolher - " AutoPostBack="t rue" EnableLoadOnDem and="true" </telerik:RadComb oBox>
<telerik:RadBut ton ID="ButtonPerfo rmSearch" Text="Aceder à listagem de timesheets" ValidationGroup ="search" OnClick="Button PerformSearch_C lick"
runat="server" CssClass="btn btn-mini" Width="50%" ButtonType="Tog gleButton"
CausesValidatio n="true"></telerik:RadButt on>
<asp:LinkButt on ID="lkbPesquisa r" runat="server" CssClass="btn btn-mini" OnClick="lkbPes quisar_Click">p esquisar</asp:LinkButton>

<asp:ObjectData Source ID="DataSourceT imesheets" runat="server" EnablePaging="T rue" OnSelecting="Da taSourceTimeshe ets_Selecting" SortParameterNa me="sortType" TypeName="UMinh o.GestaoProject os.BLL.BLLLista gemTimesheets"
SelectMethod="G etList" SelectCountMeth od="GetListCoun t">

<SelectParamete rs>

<asp:ControlPar ameter ControlID="rdpI nvestigador" Name="IDRecurso Humano" PropertyName="S electedValue" DefaultValue="" Type="Int32" />

<asp:Paramete r Name="ID" Type="Int32" />

<asp:Paramete r Name="DataEnvio " Type="datetime" />

<asp:Paramete r Name="IDEstadoT imesheet" Type="Int32" />

<asp:Paramete r Name="Assinatur aTimesheet" Type="string" />

<asp:Paramete r Name="Observaçõ es" Type="string" />

<asp:Paramete r Name="Ficheiro" Type="string" />

<asp:Paramete r Name="FileTipo" Type="string" />

<asp:Paramete r Name="FileConte nt" Type="Byte" />

<asp:Paramete r Name="login" Type="String" />


</SelectParameter s>
</asp:ObjectDataS ource>

//BLL method, used in object data source (wanted data that not load is "listagem timesheet"

public List<ListagemTi mesheet> GetList(int? ID, int? IDRecursoHumano , DateTime? DataEnvio, string AssinaturaTimes heet,int? IDEstadoTimeshe et, string Observações, string Ficheiro, string FileTipo, byte FileContent, string sortType, int maximumRows, int startRowIndex, string login)
{
using (GestaoProjecto sEntities db = new GestaoProjectos Entities())
{
var entities = from e in db.ListagemTime sheets
select e;

entities = GetQueryList(en tities, ID, IDRecursoHumano , DataEnvio, AssinaturaTimes heet, IDEstadoTimeshe et, Observações, Ficheiro, FileTipo, FileContent, login);

entities = GetListSort(ent ities.AsQueryab le(), sortType);

entities.Skip(s tartRowIndex).T ake(maximumRows );

return entities.ToList ();
}
}

public int GetListCount(in t? ID, int? IDRecursoHumano , DateTime? DataEnvio, string AssinaturaTimes heet,int? IDEstadoTimeshe et, string Observações, string Ficheiro, string FileTipo, byte FileContent, string login)
{
using (GestaoProjecto sEntities db = new GestaoProjectos Entities())
{
var entities = from e in db.ListagemTime sheets
select e;

return GetQueryList(en tities, ID, IDRecursoHumano , DataEnvio, AssinaturaTimes heet, IDEstadoTimeshe et, Observações, Ficheiro, FileTipo, FileContent, login).Count();
}
}

// Cs class, with 2 approachs managed by the 2 buttons

Expand|Select|Wrap|Line Numbers
  1. public Utils.FormMode FormMode
  2.     {
  3.         get { return ViewState["___formmode"] == null ? Utils.FormMode.CreateMode : (Utils.FormMode)ViewState["___formmode"]; }
  4.  
  5.         set { ViewState["___formmode"] = value; }
  6.     }
  7.     //ID
  8.     public int ID
  9.     {
  10.         get { return ViewState["___entitypk"] == null ? 0 : (int)ViewState["___entitypk"]; }
  11.  
  12.         set { ViewState["___entitypk"] = value; }
  13.     }
  14.  
  15.     BLLListagemTimesheets listagembll = new BLLListagemTimesheets();
  16.     BLLPesquisarTimesheet pesquisarbll = new BLLPesquisarTimesheet();
  17.     BLLTemplateFile templatebll = new BLLTemplateFile();
  18.  
  19.     protected void Page_Load(object sender, EventArgs e)
  20.     {
  21.         //Get reference to AjaxManager (from Master) 
  22.         var manager = RadAjaxManager.GetCurrent(Page);
  23.  
  24.         //Create a new delegate to handle the AjaxRequest event 
  25.         //manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest);
  26.  
  27.         //Add your ajax settings programmatically (with ref to Master manager) 
  28.         manager.AjaxSettings.AddAjaxSetting(manager, gvTimesheets);
  29.  
  30.         if (Request.QueryString["ID"] != null)
  31.         {
  32.             if (Request.QueryString["action"] != "TemplateFileDownload")
  33.                 DownloadFile(Convert.ToInt32(Request.QueryString["ID"]));
  34.             else
  35.                 ExportFile_Click();
  36.         }
  37.  
  38.         else
  39.         {
  40.             if (!Page.IsPostBack)
  41.             {
  42.                 RecursoHumano rh = new RecursoHumano();
  43.  
  44.                 rdpUnidade.DataValueField = "ID";
  45.                 rdpUnidade.DataTextField = "NomeUnidade";
  46.                 rdpUnidade.DataSource = new BLLUnidades().GetAllCentrosInvestigacao();
  47.                 rdpUnidade.DataBind();
  48.                 //rdpUnidade.ClearSelection();
  49.  
  50.                 // Sem filtros (Nao consigo utilizar o AjaxManager!) // new BLLProjectoEquipa().GetAll()
  51.                 rdpInvestigador.DataSource = new BLLRecursoHumano().GetAll();
  52.                 rdpInvestigador.DataValueField = "ID";
  53.                 rdpInvestigador.DataTextField = "Nome";
  54.                 rdpInvestigador.DataBind();
  55.                 rdpInvestigador.Items.Insert(0, new RadComboBoxItem("", ""));
  56.  
  57.  
  58.             }
  59.         }
  60.       //2 approaches, 1st one
  61.  
  62.       protected void ButtonPerformSearch_Click(object sender, EventArgs e)
  63.     {
  64.         gvTimesheets.Rebind();
  65.     }
  66.  
  67.     protected void rdpInvestigador_SelectedIndexChanged(object sender, EventArgs e)
  68.     {
  69.         gvTimesheets.DataSource = rdpInvestigador.SelectedValue;
  70.         gvTimesheets.Rebind();
  71.     }  
  72.       //Second
  73.  
  74.      protected void lkbPesquisar_Click(object sender, EventArgs e)
  75.     {
  76.         BindInvestigadores();
  77.     }
  78.  
  79.      private void BindInvestigadores() // gvTimesheets.DataBind(); nao dá exception mas nao carrega
  80.     {
  81.  
  82.         gvTimesheets.DataBind();
  83.     }
After many tries, i have no ideia about what's wrong, does anyone familiar with this?
Oct 18 '21 #1
0 3887

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4079
by: Snake | last post by:
I have a vb .net program which fills a data grid upon form load from an acccess database. This works great. Now, I have to add a combo box and use it to alter the underlying sql statement and re-fill the data grid. I have never done this before, but I created a new sql statement in strSql from the combobox, update the data adapter, and try to fill the data grid. The program halts on the Fill with no particular explanation or complaint...
1
1575
by: atif | last post by:
i m using webmatrix n i hav a prob with editable data grid. i hav set the data grid with to 100% when i load the page the data grid fits into the screen 100%. but when i clicked on add new or on update that a horizontal scroll bar used to appear n i m unable to read all the records i hav to scroll till to the end. Plz help me out Posted Via Usenet.com Premium Usenet Newsgroup Services...
6
6689
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
0
4157
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i "inizialize" the Data Grid View (add a data sorce, filled with notthing at staratup, and hide some columns) when i put a code in the txtCLCOD textbox start a searsh. If i foud something i popolate the Data grid view on the second page. Now the magic if i...
2
3128
by: jvdub22 | last post by:
I am currently using a VB 6 MS Data Grid Control bound to an SQL express data base. My grid has 20 visible rows when I load my form, when I scroll down and select a row higher than 20 the grid refers back to the corresponding row in the original 1-20. For example I can select any row less than 20 just fine, but if I select row 22 the grid will move me to row 2 or if select row 58 the grid moves me to row 18. I've read that this behavior is...
0
1229
by: sumaira_it | last post by:
Hi I am building window forms application. i have made a design time data grid. I populated the data grid on form load by fill method of adapter (Where Column1 = 1). I want that when i click on update button the changes made to the data grid should save in the table. I am a beginner. Please help me in this regard,
0
1183
by: Rasika WIJAYARATNE | last post by:
Hi everyone, I have two grid-views and I am trying to populate the data on gv2 based on the selection in gv1. However when a row is selected in gv1, it doesn't populate the gv2 with data. I have ensured that the ObjectDataSource (ods2) for gv2 works and load data correctly by specifying hardcoded primary key value within a Paramater. Anyone know what is a miss here to prevent gv2 from loading it's data???
0
1155
by: newsaboutgod | last post by:
I am loading a dataset from a XML file. I want to allow the user to display data from the dataset in a grid. Depending on which button they click i want to load the grid with a subset of data from the dataset. So, once I load the dataset from the XML file, how would I load the grid with only the data from the dataset that had "smith" in the last name?
3
14780
by: vibhakhushi | last post by:
Hi, I'm trying to load data to my grid panel which resides in php using JsonStore object. But the problem is JsonStore is not getting data from php only. Can anyone tell me where i've gone wrong. Is my php file is proper or not? I'm very new to both php and extjs. please help me out. i'm uploading the both .js and .php files. please help me out. test.js file: Ext.onReady(function(){ alert("inside onReady"); Ext.QuickTips.init(); ...
0
8251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5408
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3859
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2385
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.